bin/154147: netstat -ian leaking out embedded scope index
Petr Lampa
lampa at fit.vutbr.cz
Thu Jan 20 12:40:11 UTC 2011
The following reply was made to PR bin/154147; it has been noted by GNATS.
From: Petr Lampa <lampa at fit.vutbr.cz>
To: bug-followup at FreeBSD.org, lampa at fit.vutbr.cz
Cc:
Subject: Re: bin/154147: netstat -ian leaking out embedded scope index
Date: Thu, 20 Jan 2011 13:38:54 +0100
I've just found yet another case of leaking out embedded scope index:
netstat -i
em0 1500 fe80:1::230:4 fe80:1::230:48ff: 943 - - 9907 -
lo0 16384 fe80:3::1 fe80:3::1 0 - - 0 -
should be:
em0 1500 fe80::230:48f fe80::230:48ff:fe 943 - - 9913 -
lo0 16384 fe80::1 fe80::1 0 - - 0 -
Here is the second patch:
*** if.c.old 2011-01-19 18:41:32.000000000 +0100
--- if.c 2011-01-20 13:32:10.000000000 +0100
***************
*** 347,352 ****
--- 347,358 ----
#ifdef INET6
case AF_INET6:
sockin6 = (struct sockaddr_in6 *)sa;
+ if (IN6_IS_ADDR_LINKLOCAL(&sockin6->sin6_addr) |
|
+ IN6_IS_ADDR_MC_NODELOCAL(&sockin6->sin6_addr
) ||
+ IN6_IS_ADDR_MC_LINKLOCAL(&sockin6->sin6_addr
)) {
+ sockin6->sin6_addr.s6_addr[2] = 0;
+ sockin6->sin6_addr.s6_addr[3] = 0;
+ }
printf("%-13.13s ",
netname6(&ifaddr.in6.ia_addr,
&ifaddr.in6.ia_prefixmask.sin6_addr));
Petr Lampa
--
Computer Centre E-mail: lampa at fit.vutbr.cz
Faculty of Information Technology Web: http://www.fit.vutbr.cz/
Brno University of Technology Fax: +420 54114-1270
Bozetechova 2, 612 66 Brno, Czech Republic Phone: +420 54114-1225
More information about the freebsd-bugs
mailing list