wake on lan

Asked by andreas

Hello

I am trying to wol a client from the epoptes software but I cant..if I open a terminal and type "wakeonlan XX:XX:XX:XX:XX" the client starts normally but I cant start it from the epoptes sw pressing the Wake ON Lan Button.
I am using the latest version of Epoptes and my NIC is RTL8169.
Could you please advice?
thank you

Question information

Language:
English Edit question
Status:
Answered
For:
Epoptes Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Fotis Tsamis (ftsamis) said :
#1

Hello andreas,

Please try executing:
python /usr/share/pyshared/epoptes/core/wol.py XX:XX:XX:XX:XX
aswell, and see if it works or displays any errors.

Revision history for this message
Fotis Tsamis (ftsamis) said :
#2

Also, I am assuming that you have put the client you are trying to WoL in an epoptes group. Is that correct?

Revision history for this message
andreas (andtrds) said :
#3

yes that is correct the client is in a group
when I run the python command I get the following :

sudo python /usr/share/pyshared/epoptes/core/wol.py C4:54:44:52:46:34
Sending magic packet to C45444524634
Traceback (most recent call last):
  File "/usr/share/pyshared/epoptes/core/wol.py", line 122, in <module>
    wake_on_lan(mac)
  File "/usr/share/pyshared/epoptes/core/wol.py", line 117, in wake_on_lan
    for br in getBroadcastList():
  File "/usr/share/pyshared/epoptes/core/wol.py", line 89, in getBroadcastList
    brlist.append(getBroadcast(ifname))
  File "/usr/share/pyshared/epoptes/core/wol.py", line 82, in getBroadcast
    return socket.inet_ntoa(result[20:24])
TypeError: 'NoneType' object has no attribute '__getitem__'

Revision history for this message
Óscar (osvamon) said :
#4

Hello,

I had this same problem. That message appears, I think, because of calling getBroadcast with a None value for interface name.

In the code of getInterfaceList, the size of the struct is 120. If you change the code as it follows, to pick 40 characters blocks instead of 32, it works. However, I don't know if this happens only in certain machines or why.

This machine is running :
Linux ltsp-wheezy 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.4-1~bpo70+1 (2014-05-14) x86_64 GNU/Linux

def getInterfaceList():
    """ Get all interface names in a list """
    # get interface list
    buffer = array.array('c', '\0' * 1024)
    ifconf = struct.pack("iP", buffer.buffer_info()[1], buffer.buffer_info()[0])
    result = fcntl.ioctl(sockfd.fileno(), SIOCGIFCONF, ifconf)

    # loop over interface names
    iflist = []
    size, ptr = struct.unpack("iP", result)
    for idx in range(0, size, 40):
        ifconf = buffer.tostring()[idx:idx+40]
        name, dummy = struct.unpack("20s20s", ifconf)
        name, dummy = name.split('\0', 1)
        iflist.append(name)

    return iflist

Revision history for this message
Óscar (osvamon) said :
#5

Oops, forgot to mention you have to change the packing format from 16s16s to 20s20s accordingly :

name, dummy = struct.unpack("20s20s", ifconf)

:)

Revision history for this message
Fotis Tsamis (ftsamis) said :
#6

This problem should be fixed in trunk (and in the next version). Check Bug #1341278.

Thank you

Can you help with this problem?

Provide an answer of your own, or ask andreas for more information if necessary.

To post a message you must log in.