Bug#312093: netspeed: network interfaces showing up multiple times

Hans Ulrich Niedermann Hans Ulrich Niedermann <debian@n-dimensional.de>, 312093@bugs.debian.org
Wed, 08 Jun 2005 00:55:11 +0200


> 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. :)

Uli