PyIface icon indicating copy to clipboard operation
PyIface copied to clipboard

Does not work for Solaris 10/Sparc

Open hjoukl opened this issue 11 years ago • 1 comments

Hi, nice module, works as a charm for me on Linux. On Solaris I don't retrieve any of the machine's interfaces with pyiface.getIfaces(). Chances are that you don't have access to the Solaris platform, but just to let you and potential users know:

$ uname -a
SunOS dev001 5.10 Generic_137111-07 sun4u sparc SUNW,Sun-Fire-V490 Solaris
0 $ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000 
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet xx.yy.32.85 netmask fffff000 broadcast xx.yy.47.255
qfe0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
inet xx.yy.48.85 netmask fffff000 broadcast xx.yy.63.255
0  $ python2.7 -i -c 'import pyiface'
>>> pyiface.getIfaces()
[]

I guess that's due to some various platform-specific intricacies. Unfortunately I can't currently look into this any more but the error that is raised from Interface.__doIoctl(...) is

>>> pyiface.getIfaces()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyiface/iface.py", line 388, in getIfaces
ifa = Interface(idx=i)
File "pyiface/iface.py", line 174, in __init__
self._name = self.name
File "pyiface/iface.py", line 227, in name
self.__doIoctl(ifr, SIOCGIFNAME)
File "pyiface/iface.py", line 191, in __doIoctl
raise ioException
IOError: [Errno 22] Invalid argument

(your actual code doesn't raise and suppresses the exception I just quick-and-dirty changed that to get an idea)

Would be great if your approach could work cross-platform (Windows?).

hjoukl avatar Jul 17 '13 09:07 hjoukl

Hello there hjoukl!

Indeed the module is currently only working on Linux.

I do have plans to port it to other platform but due to lack of time this has not happened yet. The thing is that every OS exports different interface to get/set the network interfaces. Due to this the port must be done for each one individually.

Help is always welcome and appreciated. If you are keen to make it work on Solaris I will guide you. Note that Windows is very different in the way it controls its interfaces and a lot of effort will be needed to port.

bat-serjo avatar Jul 17 '13 14:07 bat-serjo