Hi, I noticed that problem as well and I think it's a bug. The fields 'sin6_scope_id' and 'sin6_flowinfo' of the sockaddr_in6 structure are not initialized (e.g. for remaddr in netstat.c:tcp_do_one()). Therefore getnameinfo() returns '<address>%<scope>' with an arbitrary <scope> for addresses that can't be resolved.
I suggest to apply the attached patch against net-tools-1.60/lib/inet6.c to fix the problem. Marco -- OpenPGP Key ID: 0x62937F7F
--- net-tools-1.60.bak/lib/inet6.c 2000-10-28 13:04:00.000000000 +0200 +++ net-tools-1.60/lib/inet6.c 2010-07-05 19:58:57.000000000 +0200 @@ -136,14 +136,16 @@ static char *INET6_sprint(struct sockadd static int INET6_getsock(char *bufp, struct sockaddr *sap) { struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *) sap; sin6->sin6_family = AF_INET6; sin6->sin6_port = 0; + sin6->sin6_scope_id = 0; + sin6->sin6_flowinfo = 0; if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0) return (-1); return 16; /* ?;) */ }
signature.asc
Description: OpenPGP digital signature