[Midnightbsd-cvs] src [10742] sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 18:10:50 EDT 2018


Revision: 10742
          http://svnweb.midnightbsd.org/src/?rev=10742
Author:   laffer1
Date:     2018-06-09 18:10:49 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/usr.sbin/ifmcstat/ifmcstat.8
    trunk/usr.sbin/ifmcstat/ifmcstat.c

Property Changed:
----------------
    trunk/usr.sbin/ifmcstat/ifmcstat.8

Modified: trunk/usr.sbin/ifmcstat/ifmcstat.8
===================================================================
--- trunk/usr.sbin/ifmcstat/ifmcstat.8	2018-06-09 22:10:16 UTC (rev 10741)
+++ trunk/usr.sbin/ifmcstat/ifmcstat.8	2018-06-09 22:10:49 UTC (rev 10742)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$KAME: ifmcstat.8,v 1.6 2002/10/31 04:23:43 suz Exp $
 .\"
 .\" Copyright (c) 2007-2009 Bruce Simpson.
@@ -28,7 +29,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/ifmcstat/ifmcstat.8 233455 2012-03-25 09:18:34Z joel $
 .\"
 .Dd May 27, 2009
 .Dt IFMCSTAT 8
@@ -123,7 +124,6 @@
 is more limited.
 This support is recommended for debugging purposes.
 It requires super-user privilege if used to inspect a running kernel.
-.Pp
 .Sh SEE ALSO
 .Xr netstat 1 ,
 .Xr getifaddrs 3 ,


Property changes on: trunk/usr.sbin/ifmcstat/ifmcstat.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/ifmcstat/ifmcstat.c
===================================================================
--- trunk/usr.sbin/ifmcstat/ifmcstat.c	2018-06-09 22:10:16 UTC (rev 10741)
+++ trunk/usr.sbin/ifmcstat/ifmcstat.c	2018-06-09 22:10:49 UTC (rev 10742)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$KAME: ifmcstat.c,v 1.48 2006/11/15 05:13:59 itojun Exp $	*/
 
 /*
@@ -31,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.sbin/ifmcstat/ifmcstat.c 245015 2013-01-03 22:27:57Z hrs $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -167,7 +168,7 @@
 #endif
 #ifdef INET6
 static void		in6_ifinfo(struct mld_ifinfo *);
-static const char *	inet6_n2a(struct in6_addr *);
+static const char *	inet6_n2a(struct in6_addr *, uint32_t);
 #endif
 int			main(int, char **);
 
@@ -296,7 +297,8 @@
 		printf("igmpv?(%d)", igi->igi_version);
 		break;
 	}
-	printb(" flags", igi->igi_flags, "\020\1SILENT\2LOOPBACK");
+	if (igi->igi_flags)
+		printb(" flags", igi->igi_flags, "\020\1SILENT\2LOOPBACK");
 	if (igi->igi_version == IGMP_VERSION_3) {
 		printf(" rv %u qi %u qri %u uri %u",
 		    igi->igi_rv, igi->igi_qi, igi->igi_qri, igi->igi_uri);
@@ -459,7 +461,8 @@
 		if (sa.sa_family != PF_INET6)
 			goto nextifap;
 		KREAD(ifap, &if6a, struct in6_ifaddr);
-		printf("\tinet6 %s\n", inet6_n2a(&if6a.ia_addr.sin6_addr));
+		printf("\tinet6 %s\n", inet6_n2a(&if6a.ia_addr.sin6_addr,
+		    if6a.ia_addr.sin6_scope_id));
 		/*
 		 * Print per-link MLD information, if available.
 		 */
@@ -514,7 +517,7 @@
 	struct in6_multi multi;
 
 	KREAD(mc, &multi, struct in6_multi);
-	printf("\t\tgroup %s", inet6_n2a(&multi.in6m_addr));
+	printf("\t\tgroup %s", inet6_n2a(&multi.in6m_addr, 0));
 	printf(" refcnt %u\n", multi.in6m_refcount);
 
 	return (multi.in6m_entry.le_next);
@@ -751,7 +754,8 @@
 		printf("mldv?(%d)", mli->mli_version);
 		break;
 	}
-	printb(" flags", mli->mli_flags, "\020\1SILENT");
+	if (mli->mli_flags)
+		printb(" flags", mli->mli_flags, "\020\1SILENT\2USEALLOW");
 	if (mli->mli_version == MLD_VERSION_2) {
 		printf(" rv %u qi %u qri %u uri %u",
 		    mli->mli_rv, mli->mli_qi, mli->mli_qri, mli->mli_uri);
@@ -764,11 +768,10 @@
 }
 
 static const char *
-inet6_n2a(struct in6_addr *p)
+inet6_n2a(struct in6_addr *p, uint32_t scope_id)
 {
 	static char buf[NI_MAXHOST];
 	struct sockaddr_in6 sin6;
-	u_int32_t scopeid;
 	const int niflags = NI_NUMERICHOST;
 
 	memset(&sin6, 0, sizeof(sin6));
@@ -775,15 +778,7 @@
 	sin6.sin6_family = AF_INET6;
 	sin6.sin6_len = sizeof(struct sockaddr_in6);
 	sin6.sin6_addr = *p;
-	if (IN6_IS_ADDR_LINKLOCAL(p) || IN6_IS_ADDR_MC_LINKLOCAL(p) ||
-	    IN6_IS_ADDR_MC_NODELOCAL(p)) {
-		scopeid = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
-		if (scopeid) {
-			sin6.sin6_scope_id = scopeid;
-			sin6.sin6_addr.s6_addr[2] = 0;
-			sin6.sin6_addr.s6_addr[3] = 0;
-		}
-	}
+	sin6.sin6_scope_id = scope_id;
 	if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,
 	    buf, sizeof(buf), NULL, 0, niflags) == 0) {
 		return (buf);
@@ -888,7 +883,7 @@
 /*
  * Retrieve MLD per-group source filter mode and lists via sysctl.
  *
- * Note: The 128-bit IPv6 group addres needs to be segmented into
+ * Note: The 128-bit IPv6 group address needs to be segmented into
  * 32-bit pieces for marshaling to sysctl. So the MIB name ends
  * up looking like this:
  *  a.b.c.d.e.ifindex.g[0].g[1].g[2].g[3]
@@ -1115,7 +1110,8 @@
 #ifdef INET6
 			{
 				const char *p =
-				    inet6_n2a(&pifasa->sin6.sin6_addr);
+				    inet6_n2a(&pifasa->sin6.sin6_addr,
+					pifasa->sin6.sin6_scope_id);
 				strlcpy(addrbuf, p, sizeof(addrbuf));
 				break;
 			}
@@ -1136,7 +1132,14 @@
 				break;
 			}
 
-			fprintf(stdout, "\t%s %s\n", pafname, addrbuf);
+			fprintf(stdout, "\t%s %s", pafname, addrbuf);
+#ifdef INET6
+			if (pifasa->sa.sa_family == AF_INET6 &&
+			    pifasa->sin6.sin6_scope_id)
+				fprintf(stdout, " scopeid 0x%x",
+				    pifasa->sin6.sin6_scope_id);
+#endif
+			fprintf(stdout, "\n");
 #ifdef INET
 			/*
 			 * Print per-link IGMP information, if available.
@@ -1196,7 +1199,8 @@
 		/* Print this group address. */
 #ifdef INET6
 		if (pgsa->sa.sa_family == AF_INET6) {
-			const char *p = inet6_n2a(&pgsa->sin6.sin6_addr);
+			const char *p = inet6_n2a(&pgsa->sin6.sin6_addr,
+			    pgsa->sin6.sin6_scope_id);
 			strlcpy(addrbuf, p, sizeof(addrbuf));
 		} else
 #endif
@@ -1208,6 +1212,12 @@
 		}
 
 		fprintf(stdout, "\t\tgroup %s", addrbuf);
+#ifdef INET6
+		if (pgsa->sa.sa_family == AF_INET6 &&
+		    pgsa->sin6.sin6_scope_id)
+			fprintf(stdout, " scopeid 0x%x",
+			    pgsa->sin6.sin6_scope_id);
+#endif
 #ifdef INET
 		if (pgsa->sa.sa_family == AF_INET) {
 			inm_print_sources_sysctl(thisifindex,



More information about the Midnightbsd-cvs mailing list