Package: net-tools
Version: 1.60-19

When more than 256 network interfaces exist or have existed on a given
system, /proc/net/if_inet6 contains an interface number (the second
column, immediately after the IPv6 address) which is no longer
formated as a two-digit hexadecimal number and this confuses ifconfig
and netstat -ie, causing it to stop printing IPv6 addresses for all
interfaces.

Steps to reproduce: create a network interface (typically with pppd),
delete it, repeat 256 times, then run /sbin/ifconfig and observe that
it no longer prints the IPv6 addresses for any interface on the
system.

Note: the file is printed by net/ipv6/addrconf.c in the kernel source,
function if6_seq_show(): note that ifp->idev->dev->ifindex is printed
with %02x, but it is an int and nothing guarantees that it will stay
below 256.

The attached patch fixes the problem.

-- 
     David A. Madore
    ([EMAIL PROTECTED],
     http://www.madore.org/~david/ )
diff -ruNp net-tools-1.60.orig/lib/interface.c net-tools-1.60/lib/interface.c
--- net-tools-1.60.orig/lib/interface.c	2008-04-09 23:19:46.000000000 +0200
+++ net-tools-1.60/lib/interface.c	2008-04-09 23:20:00.000000000 +0200
@@ -718,7 +718,7 @@ void ife_print_long(struct interface *pt
     /* FIXME: should be integrated into interface.c.   */
 
     if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
-	while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+	while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %x %x %x %x %20s\n",
 		      addr6p[0], addr6p[1], addr6p[2], addr6p[3],
 		      addr6p[4], addr6p[5], addr6p[6], addr6p[7],
 		  &if_idx, &plen, &scope, &dad_status, devname) != EOF) {

Reply via email to