← Back to team overview

epoptes team mailing list archive

Re: [Question #250557]: wake on lan

 

Question #250557 on Epoptes changed:
https://answers.launchpad.net/epoptes/+question/250557

    Status: Open => Answered

Óscar proposed the following answer:
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

-- 
You received this question notification because you are a member of
Epoptes Developers, which is an answer contact for Epoptes.