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

2005-06-08 Thread Joergen Scheibengruber
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]




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

2005-06-08 Thread Hans Ulrich Niedermann
Joergen Scheibengruber [EMAIL PROTECTED] writes:

 On Wed, 2005-06-08 at 00:55 +0200, Hans Ulrich Niedermann wrote:

 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.

Obviously in a way wrong for what we want.

But we should read the corresponding docs first. The man page says:

   NAME
   if_nameindex - return all network interface names and indexes

and the info page says:

 -- Function: struct if_nameindex * if_nameindex (void)
 This function returns an array of `if_nameindex' structures, one
 for every interface that is present.  

which suggests that the glibc behaviour of
   a) listing only interfaces with IPv4 addresses (it says
  all or every interface in the docs)
   b) listing interfaces as many times as they have IPv4 addresses
  bound to them
is wrong.

Short test program, in case someone needs it:

#include stdio.h
#include net/if.h

int main(int argc, char *argv[])
{
int i;
struct if_nameindex *ifs = if_nameindex();
if (ifs == NULL) {
perror(could not run if_nameindex);
return 1;
}
for (i=0; (i=0)  (ifs[i].if_index != 0)  (ifs[i].if_name != NULL); 
i++) {
printf(%3d  %3d  %s\n, i, ifs[i].if_index, ifs[i].if_name);
}
if_freenameindex(ifs);
}

This lists (Debian libc6 2.3.2.ds1-22) the network interface for every
IPv4 address which is bound to an interface which is up. So every
up network interface is listed as many times as it has IPv4
addresses bound to it, ignoring any IPv6 or other addresses bound to
the interface.

The intuitively expected behaviour when reading the man page would be
for if_nameindex(3) to list all network interfaces which are up,
regardless of any addresses which might or might not be bound to them.

 The version in cvs now uses libgtop2 to get the list of devices, which
 simply returns all entries of /proc/net/dev.

Hopefully it does something else on non-Linux platforms (which do not
have /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 :)

No, there are no duplicate entries in /proc/net/dev.

 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 ;))

I have only seen them show up one after the other. Which makes sense
in a kind of way, but should be verified by examining the (presumedly
buggy) glibc source code first.

Hmm. It seems we're not the first people to have those kinds of
problems:

http://lists.gnu.org/archive/html/bug-inetutils/2001-02/msg00013.html

Perhaps we should file a bug against libc6, or move this bug to libc6?

Uli


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-06-08 Thread Joergen Scheibengruber
Am Mittwoch, den 08.06.2005, 15:24 +0200 schrieb Hans Ulrich Niedermann:

[...]

 Obviously in a way wrong for what we want.

Well, doesn't matter since I'm no longer using it anyways ;)

 Hopefully it does something else on non-Linux platforms (which do not
 have /proc/net/dev).

Yeah, libgtop is multi-platform. It uses kstat_open() on solaris for
example.

  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 :)
 
 No, there are no duplicate entries in /proc/net/dev.

Fine :)

 I have only seen them show up one after the other. Which makes sense
 in a kind of way, but should be verified by examining the (presumedly
 buggy) glibc source code first.

Ah, well I don't think it's a bug. Probably the definition of what the
function should do just isn't strict/clear enough. Or whatever ;)

 Hmm. It seems we're not the first people to have those kinds of
 problems:
 
 http://lists.gnu.org/archive/html/bug-inetutils/2001-02/msg00013.html
 
 Perhaps we should file a bug against libc6, or move this bug to libc6?

Well, I don't know if it's really a bug, but if you think so, you should
clearly file it :)

Regards,
Jörgen



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-06-08 Thread Hans Ulrich Niedermann
Joergen Scheibengruber [EMAIL PROTECTED] writes:

 Am Mittwoch, den 08.06.2005, 15:24 +0200 schrieb Hans Ulrich Niedermann:

 Well, I don't know if it's really a bug, but if you think so, you should
 clearly file it :)

To conclude this matter:

  - The problem is fixed in netspeed (by moving from glibc's
if_nameindex(3) functions to libgtop).

  - I still think this is a bug in glibc, so I have filed it there as
a separate bug.

Uli


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-06-07 Thread Hans Ulrich Niedermann
 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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-06-05 Thread Hans Ulrich Niedermann
Package: netspeed
Version: 0.11-1
Severity: normal


The Netspeed Preferences dialog allows chosing the Network device
from a list of devices in a dropdown box. On this system, the same
interface shows up multiple times, and selecting different versions for
the same device makes no noticeable difference.

I suggest getting rid of the multiple interface.

The list it shows here is

lo
lo
eth0
eth0
dummy0
dummy0
dummy0

which coincides with the number of IPv4 addresses on the respective
device:

1: lo: LOOPBACK,UP mtu 16436 qdisc noqueue 
inet 127.0.0.1/8 scope host lo
inet 169.254.185.103/16 scope link lo
2: eth0: BROADCAST,MULTICAST,UP mtu 1500 qdisc pfifo_fast qlen 1000
inet 169.254.28.139/16 scope link eth0
inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0
5: dummy0: BROADCAST,NOARP,UP mtu 1500 qdisc noqueue 
inet 169.254.155.71/16 scope link dummy0
inet 192.168.1.1/32 brd 192.168.1.255 scope global dummy0
inet 192.168.1.2/32 scope global dummy0

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (800, 'unstable'), (100, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.11.10-swsusp2-ndim-2
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages netspeed depends on:
ii  libart-2.0-2 2.3.17-1Library of functions for 2D graphi
ii  libatk1.0-0  1.8.0-4 The ATK accessibility toolkit
ii  libbonobo2-0 2.8.1-2 Bonobo CORBA interfaces library
ii  libbonoboui2-0   2.8.1-2 The Bonobo UI library
ii  libc62.3.2.ds1-22GNU C Library: Shared libraries an
ii  libgconf2-4  2.8.1-6 GNOME configuration database syste
ii  libglib2.0-0 2.6.4-1 The GLib library of C routines
ii  libgnome2-0  2.8.1-2 The GNOME 2 library - runtime file
ii  libgnomecanvas2-02.8.0-1 A powerful object-oriented display
ii  libgnomeui-0 2.8.1-3 The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0   2.8.4-4 The GNOME virtual file-system libr
ii  libgtk2.0-0  2.6.4-3 The GTK+ graphical user interface 
ii  libice6  4.3.0.dfsg.1-14 Inter-Client Exchange library
ii  liborbit21:2.12.2-1  libraries for ORBit2 - a CORBA ORB
ii  libpanel-applet2-0   2.8.3-1 library for GNOME 2 panel applets
ii  libpango1.0-01.8.1-1 Layout and rendering of internatio
ii  libpopt0 1.7-5   lib for parsing cmdline parameters
ii  libsm6   4.3.0.dfsg.1-14 X Window System Session Management
ii  libxml2  2.6.16-7GNOME XML library
ii  xlibs4.3.0.dfsg.1-14 X Keyboard Extension (XKB) configu
ii  zlib1g   1:1.2.2-4   compression library - runtime

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]