A step further, but still not ok, IMHO. It displays all the interfaces ___that do have an ip address___.
The output of inetutils ifconfig is below followed by the output of the net- tools one. net tools shows also the ipv6 address of the interface that could be good to add to inetutils too :-).. Thanks Giampaolo ------------------------------------------------------------------------------------------------------------ inetutils ifconfig output dummy0 Link encap:Ethernet HWaddr 12:27:1C:2A:9A:69 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:48 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 TX bytes:5064 eth0 Link encap:Ethernet HWaddr 00:16:D3:5B:F6:0D inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3951 errors:0 dropped:0 overruns:0 frame:0 TX packets:3688 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2762099 TX bytes:607312 Interrupt:16 eth0:test Link encap:Ethernet HWaddr 00:16:D3:5B:F6:0D inet addr:192.168.100.100 Bcast:192.168.100.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:16 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:905427 errors:0 dropped:0 overruns:0 frame:0 TX packets:905427 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:375065391 TX bytes:375065391 tap0 Link encap:Ethernet HWaddr CA:CE:C4:E8:42:AB inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:4893 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:0 TX bytes:0 -------------------------------------------------------------------------------------------------------------- net tools 1.60 ifconfig output dummy0 Link encap:Ethernet HWaddr 12:27:1C:2A:9A:69 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::1027:1cff:fe2a:9a69/64 Scope:Link UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:48 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:5064 (4.9 Kb) eth0 Link encap:Ethernet HWaddr 00:16:D3:5B:F6:0D inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::216:d3ff:fe5b:f60d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3953 errors:0 dropped:0 overruns:0 frame:0 TX packets:3688 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2762227 (2.6 Mb) TX bytes:607312 (593.0 Kb) Interrupt:16 eth0:test Link encap:Ethernet HWaddr 00:16:D3:5B:F6:0D inet addr:192.168.100.100 Bcast:192.168.100.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:16 gre0 Link encap:UNSPEC HWaddr 00-00-00-00- FF-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:1476 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) ip6tnl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:1460 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:905449 errors:0 dropped:0 overruns:0 frame:0 TX packets:905449 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:375067639 (357.6 Mb) TX bytes:375067639 (357.6 Mb) sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) tap0 Link encap:Ethernet HWaddr CA:CE:C4:E8:42:AB inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::c8ce:c4ff:fee8:42ab/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:4893 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) tunl0 Link encap:IPIP Tunnel HWaddr NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) vboxnet0 Link encap:Ethernet HWaddr 0A:00:27:00:00:00 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) On Friday 30 July 2010 01:58:42 Giuseppe Scrivano wrote: > Hello, > > Giampaolo Gallo <g...@iws.it> writes: > > You did thanks.. > > > > I flushed the stdout and the result was the same, so, IMHO it isn't a > > buffering problem. > > The command "ifconfig -a" sould show all the interfaces installed on my > > machine. It shows only the loopback (lo) interface instead. The program > > parses the full content of /proc/net/dev but it shows only the first > > interface it finds, i.e. "lo". > > I tried also by changing the backend (system/linux.* -> system/generic.*) > > without success. > > My machine is a Linux x86_64 2.6.34.1 with glibc 2.11.2. If you want more > > information please ask and I will be happy to answer. > > can you please try the attached patch? Does it fix the problem for you? > > Cheers, > Giuseppe > > From 95ac7d15532a2a42db9048d4cc7b8ca4f7b2c3bd Mon Sep 17 00:00:00 2001 > From: Giuseppe Scrivano <gscriv...@gnu.org> > Date: Fri, 30 Jul 2010 01:53:57 +0200 > Subject: [PATCH] * ifconfig/if_index.c (if_nameindex): Remove local > variable `len'. Remove code that compute the sizeof of the struct `ifreq'. > > --- > ChangeLog | 5 +++++ > ifconfig/if_index.c | 12 +----------- > 2 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 9c5795e..052daee 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,8 @@ > +2010-07-30 Giuseppe Scrivano <gscriv...@gnu.org> > + > + * ifconfig/if_index.c (if_nameindex): Remove local variable `len'. > + Remove code that compute the sizeof of the struct `ifreq'. > + > 2010-07-10 Alfred M. Szmidt <a...@gnu.org> > > * ifconfig/options.c (parse_opt_set_default_format): Abort if no > diff --git a/ifconfig/if_index.c b/ifconfig/if_index.c > index 1080aca..3062bf7 100644 > --- a/ifconfig/if_index.c > +++ b/ifconfig/if_index.c > @@ -132,19 +132,9 @@ if_nameindex (void) > end = (struct ifreq *) ((caddr_t) ifr + ifc.ifc_len); > while (ifr < end) > { > - int len; > -# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN > -# undef MAX > -# define MAX(a,b) (((a) > (b)) ? (a) : (b)) > - len = MAX (sizeof (struct sockaddr), ifr->ifr_addr.sa_len); > -# else > - len = sizeof (struct sockaddr); > -# endif > - > cur = ifr; > > - /* Step along the array by the size of the current structure */ > - ifr = (struct ifreq *) ((caddr_t) ifr + len + IFNAMSIZ); > + ++ifr; > > /* We ignore the other families .. OK ? */ > if (cur->ifr_addr.sa_family != AF_INET)