On Wed, 2005-06-08 at 00:55 +0200, Hans Ulrich Niedermann wrote: > > So do I understand this correctly: The solution to this would simply be > > to remove duplicates from the list of devices? > > > > That's easy to fix :) > > That should fix the symptoms, but not the problem :-) > > It seems (without reading the code, just from observing netspeed's > behaviour) that netspeed currently does something like this to find > the list of interface to possibly monitor (monitor_interfaces): > > monitor_interfaces = [] > for interface in list_of_all_interfaces: > if is_up(interface): > for ipv4_addr in addr_list(interface, AF_INET): > monitor_interfaces.append(interface) > > I'd suggest changing that logic into: > > monitor_interfaces = [] > for interface in list_of_all_interfaces: > if is_up(interface): > monitor_interfaces.append(interface) > > This > > a) makes it independent of the address family > b) adds the interface at most once to the list > c) is more simple logic > > No drawbacks. :)
Well, actually it has been doing nr. 2 all the time. But the infrastructure which is there maybe makes it seem like nr. 1. So all released versions use the glibc function if_nameindex() to get the list of devices. I don't know how it assembles the list. The version in cvs now uses libgtop2 to get the list of devices, which simply returns all entries of /proc/net/dev. So it would be interssting how /proc/net/dev looks in your case. If we don't have multiple entries there, we're all done already :) Otherwise, it would be interessting if multiple devices always show up one after each other or if the list is completely mixed (which would make removing duplicates a little bit more difficult then trivial ;)) Regards, Jörgen -- Joergen Scheibengruber <[EMAIL PROTECTED]>