Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat use NI_WITHSCOPEID when printing multicast g...
details: https://anonhg.NetBSD.org/src/rev/8611db6a39da
branches: trunk
changeset: 481931:8611db6a39da
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Feb 09 13:57:06 2000 +0000
description:
use NI_WITHSCOPEID when printing multicast group with -inav.
diffstat:
usr.bin/netstat/if.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diffs (49 lines):
diff -r 3688cff9833d -r 8611db6a39da usr.bin/netstat/if.c
--- a/usr.bin/netstat/if.c Wed Feb 09 13:40:42 2000 +0000
+++ b/usr.bin/netstat/if.c Wed Feb 09 13:57:06 2000 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index