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

Joergen Scheibengruber Joergen Scheibengruber <Joergen.Scheibengruber@informatik.uni-ulm.de>, 312093@bugs.debian.org
Wed, 08 Jun 2005 14:01:35 +0200


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?
> >=20
> > That's easy to fix :)
>=20
> That should fix the symptoms, but not the problem :-)
>=20
> 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):
>=20
>     monitor_interfaces =3D []
>     for interface in list_of_all_interfaces:
>        if is_up(interface):
>            for ipv4_addr in addr_list(interface, AF_INET):
>                monitor_interfaces.append(interface)
>=20
> I'd suggest changing that logic into:
>=20
>     monitor_interfaces =3D []
>     for interface in list_of_all_interfaces:
>        if is_up(interface):
>            monitor_interfaces.append(interface)
>=20
> This
>=20
>   a) makes it independent of the address family
>   b) adds the interface at most once to the list
>   c) is more simple logic
>=20
> 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=F6rgen

--=20
Joergen Scheibengruber <Joergen.Scheibengruber@informatik.uni-ulm.de>