use NI_WITHSCOPEID when printing multicast group with -inav.

This commit is contained in:
itojun 2000-02-09 13:57:06 +00:00
parent dc87f2899f
commit 8b2de4271e

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.38 2000/02/05 17:39:22 itojun Exp $ */
/* $NetBSD: if.c,v 1.39 2000/02/09 13:57:06 itojun Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: if.c,v 1.38 2000/02/05 17:39:22 itojun Exp $");
__RCSID("$NetBSD: if.c,v 1.39 2000/02/09 13:57:06 itojun Exp $");
#endif
#endif /* not lint */
@ -274,14 +274,28 @@ intpr(interval, ifnetaddr, pfunc)
if (aflag) {
u_long multiaddr;
struct in6_multi inm;
struct sockaddr_in6 sin6;
multiaddr = (u_long)
ifaddr.in6.ia6_multiaddrs.lh_first;
while (multiaddr != 0) {
kread(multiaddr, (char *)&inm,
sizeof inm);
inet_ntop(AF_INET6, &inm.in6m_addr,
hbuf, sizeof(hbuf));
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_len = sizeof(struct sockaddr_in6);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = inm.in6m_addr;
sin6.sin6_scope_id =
ntohs(*(u_int16_t *)
&sin6.sin6_addr.s6_addr[2]);
sin6.sin6_addr.s6_addr[2] = 0;
sin6.sin6_addr.s6_addr[3] = 0;
if (getnameinfo((struct sockaddr *)&sin6,
sin6.sin6_len, hbuf,
sizeof(hbuf), NULL, 0,
niflag) != 0) {
strcpy(hbuf, "??");
}
cp = hbuf;
if (vflag)
n = strlen(cp) < 17