bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] inetutils-1.8 - ifconfig -a doesn't work as expected


From: Giuseppe Scrivano
Subject: Re: [bug-inetutils] inetutils-1.8 - ifconfig -a doesn't work as expected
Date: Fri, 30 Jul 2010 01:58:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hello,

Giampaolo Gallo <address@hidden> 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 <address@hidden>
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  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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)
-- 
1.7.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]