Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2015 10:31:09 +0000 (UTC)
From:      Renato Botelho <garga@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r285022 - stable/10/usr.bin/netstat
Message-ID:  <201507021031.t62AV9kp060763@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: garga (ports committer)
Date: Thu Jul  2 10:31:08 2015
New Revision: 285022
URL: https://svnweb.freebsd.org/changeset/base/285022

Log:
  MFC r265096:
  
  Fix "netstat -gW" behavior broken in r259638.
  netstat has two options for printing multicast tables:
  sysctl (the default one for live systems) and kvm-based one (for cores).
  It looks like kvm-based one hasn't been working since it's been introduced
  in r190012 due to absence of mfctablesize kernel symbol.
  Check for all ipv4-multicast symbols being correctly resolved was introduced
  in r259638 regardless of 'live' value leading to "No IPv4 MROUTING" error
  message.
  
  Reported by:	Olivier Cochard-Labbé
  Approved by:	melifaro@
  Sponsored by:	Netgate

Modified:
  stable/10/usr.bin/netstat/mroute.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/netstat/mroute.c
==============================================================================
--- stable/10/usr.bin/netstat/mroute.c	Thu Jul  2 08:32:02 2015	(r285021)
+++ stable/10/usr.bin/netstat/mroute.c	Thu Jul  2 10:31:08 2015	(r285022)
@@ -236,16 +236,7 @@ mroutepr()
 	 * functionality was deprecated, as PIM does not use it.
 	 */
 	maxvif = 0;
-
-	kresolve_list(mrl);
-	pmfchashtbl = mrl[N_MFCHASHTBL].n_value;
-	pmfctablesize = mrl[N_MFCTABLESIZE].n_value;
-	pviftbl = mrl[N_VIFTABLE].n_value;
-
-	if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) {
-		fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
-		return;
-	}
+	pmfchashtbl = pmfctablesize = pviftbl = 0;
 
 	len = sizeof(viftable);
 	if (live) {
@@ -254,8 +245,19 @@ mroutepr()
 			warn("sysctl: net.inet.ip.viftable");
 			return;
 		}
-	} else
+	} else {
+		kresolve_list(mrl);
+		pmfchashtbl = mrl[N_MFCHASHTBL].n_value;
+		pmfctablesize = mrl[N_MFCTABLESIZE].n_value;
+		pviftbl = mrl[N_VIFTABLE].n_value;
+
+		if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) {
+			fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
+			return;
+		}
+
 		kread(pviftbl, (char *)viftable, sizeof(viftable));
+	}
 
 	banner_printed = 0;
 	for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507021031.t62AV9kp060763>