diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-01-01 06:35:30 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-01-01 06:35:30 +0000 |
commit | 74f98bb02e530baa6128b1815249f8d804a0fc18 (patch) | |
tree | 37586f8bb86418bd7bf9af96a1222c048a53951a | |
parent | po/man: if LINGUAS is set, only install translations for those langs (diff) | |
download | net-tools-74f98bb02e530baa6128b1815249f8d804a0fc18.tar.gz net-tools-74f98bb02e530baa6128b1815249f8d804a0fc18.tar.bz2 net-tools-74f98bb02e530baa6128b1815249f8d804a0fc18.zip |
interface: fix IPv6 parsing of interfaces with large indexes (> 255)
patch from Dave Johnson <djohnson@sw.starentnetworks.com> via Debian #433543
When running 'ifconfig' it will not show any IPv6 addresses for
interfaces that have an ifindex > 255.
Because the kernel will increment the ifindex every time an interface
is added or removed, it is not necessary to have 256 interfaces at
once, just creating 256 interfaces since system boot and they will no
longer show IPv6 addresses.
This is due to an improper fscanf() maximum range argument. Patch to
fix the problem is below.
Example:
st34:~# ip addr list dev eth1.110
268: eth1.110@eth1: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc noqueue
link/ether 00:e0:81:2a:0d:2d brd ff:ff:ff:ff:ff:ff
inet6 fd4d:5643:2886:6e::ea:0/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::2e0:81ff:fe2a:d2d/64 scope link
valid_lft forever preferred_lft forever
st34:~# ifconfig eth1.110
eth1.110 Link encap:Ethernet HWaddr 00:E0:81:2A:0D:2D
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:676 (676.0 b)
st34:~# grep eth1.110 /proc/net/if_inet6
fd4d56432886006e0000000000ea0000 10c 40 00 80 eth1.110
fe8000000000000002e081fffe2a0d2d 10c 40 20 80 eth1.110
st34:~#
-rw-r--r-- | lib/interface.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/interface.c b/lib/interface.c index 8bba5a2..c9f5923 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -7,7 +7,7 @@ 8/2000 Andi Kleen make the list operations a bit more efficient. People are crazy enough to use thousands of aliases now. - $Id: interface.c,v 1.33 2009/12/31 19:51:31 vapier Exp $ + $Id: interface.c,v 1.34 2010/01/01 06:35:30 vapier Exp $ */ #include "config.h" @@ -760,7 +760,7 @@ void ife_print_long(struct interface *ptr) /* 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 %08x %02x %02x %02x %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) { |