You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the discover command I got this error:
Searching for ProSafe Plus Switches ...
Traceback (most recent call last):
File "./psl-cli.py", line 191, in
main()
File "./psl-cli.py", line 187, in main
cmd_funcs[args.operation](args, switch)
File "./psl-cli.py", line 16, in discover
data = switch.discover()
File "/home/ianm/Downloads/ProSafeLinux-master/psl_class.py", line 383, in discover
self.mac_cache[message[self.CMD_MAC]] = message[self.CMD_IP]
TypeError: 'bool' object has no attribute 'getitem'
I'm using Python 2.7.3 and Fedora 18. This might be user error on my part.
I ran into the same problem. I did some investigation. if I do "./psi-cli --interface wlan0 discover" I have the same problem, except when I plug in a network cable into the same network so eth0 comes up. If I check with wireshark, I see a outgoing broadcast UDP packet to port 63322, from source port 63321. My switch sends a reply packet. All over eth0! Even if I explicitly replace 'eth0' by 'wlan0' in the sources this does not change. It seems binding to a specific interface fails somehow. And, there is some dependency on eth0 that I cannot find.
Ok, after some more testing (and googling..) I found a solution: in file psl_class.py on line 152 (in function bind()) change
self.rsocket.bind(("255.255.255.255", self.RECPORT))
to
self.rsocket.bind(("", self.RECPORT))
This will effectively change the listening address from INADDR_BROADCAST to INADDR_ANY; the first apparently does not work reliably (on linux?). The latter works correctly.
Just in case this is important for someone: I tested this on linux 3.9.4
Thanks josn0!
I've fixed the problem and created a pull request.
I don't know why binding to INADDR_BROADCAST doesn't work here, but as setting to INADDR_ANY fixes the thing that should be fine. The only way to use INADDR_ANY and additionally binding to a specific interface would need us to use SO_BINDTODEVICE which is a privileged option and i don't think the netgear client should be run as root :)
Package sending is correctly bind to the given INTERFACE so that change should fix the problem.
Activity
Z3po commentedon Jun 13, 2013
Which command did you use when getting this error?
mahuika88 commentedon Jun 13, 2013
It was ./psl-cli.py --interface em1 discover
josn0 commentedon Jun 16, 2013
I ran into the same problem. I did some investigation. if I do "./psi-cli --interface wlan0 discover" I have the same problem, except when I plug in a network cable into the same network so eth0 comes up. If I check with wireshark, I see a outgoing broadcast UDP packet to port 63322, from source port 63321. My switch sends a reply packet. All over eth0! Even if I explicitly replace 'eth0' by 'wlan0' in the sources this does not change. It seems binding to a specific interface fails somehow. And, there is some dependency on eth0 that I cannot find.
Ok, after some more testing (and googling..) I found a solution: in file psl_class.py on line 152 (in function bind()) change
self.rsocket.bind(("255.255.255.255", self.RECPORT))
to
self.rsocket.bind(("", self.RECPORT))
This will effectively change the listening address from INADDR_BROADCAST to INADDR_ANY; the first apparently does not work reliably (on linux?). The latter works correctly.
Just in case this is important for someone: I tested this on linux 3.9.4
Bugfix for ISSUE tabacha#22
Z3po commentedon Jun 18, 2013
Thanks josn0!
I've fixed the problem and created a pull request.
I don't know why binding to INADDR_BROADCAST doesn't work here, but as setting to INADDR_ANY fixes the thing that should be fine. The only way to use INADDR_ANY and additionally binding to a specific interface would need us to use SO_BINDTODEVICE which is a privileged option and i don't think the netgear client should be run as root :)
Package sending is correctly bind to the given INTERFACE so that change should fix the problem.