Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2023 16:24:28 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f549e22901b3 - main - ip_mroute: Fix sysctl knobs
Message-ID:  <202309271624.38RGOSFV076702@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=f549e22901b3a391c76659bee55802b1214112fd

commit f549e22901b3a391c76659bee55802b1214112fd
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-09-27 16:23:22 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-09-27 16:23:22 +0000

    ip_mroute: Fix sysctl knobs
    
    The loader tunable `net.inet.ip.mfchashsize` does not have corresponding
    sysctl MIB entry. Just add it.
    
    While here, the sysctl variable `net.inet.pim.squelch_wholepkt` is actually
    a loader tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T`
    will report it correctly.
    
    Reviewed by:    kp
    Fixes:          443fc3176dee Introduce a number of changes to the MROUTING code
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D41997
---
 sys/netinet/ip_mroute.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 2444fd9686f7..cda5f160e8fb 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -172,7 +172,9 @@ VNET_DEFINE_STATIC(u_long, mfchash);
 	  ((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & V_mfchash)
 #define	MFCHASHSIZE	256
 
-static u_long mfchashsize;			/* Hash size */
+static u_long mfchashsize = MFCHASHSIZE;	/* Hash size */
+SYSCTL_ULONG(_net_inet_ip, OID_AUTO, mfchashsize, CTLFLAG_RDTUN,
+    &mfchashsize, 0, "IPv4 Multicast Forwarding Table hash size");
 VNET_DEFINE_STATIC(u_char *, nexpire);		/* 0..mfchashsize-1 */
 #define	V_nexpire		VNET(nexpire)
 VNET_DEFINE_STATIC(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl);
@@ -226,7 +228,7 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_pim, PIMCTL_STATS, stats, struct pimstat,
     pimstat, "PIM Statistics (struct pimstat, netinet/pim_var.h)");
 
 static u_long	pim_squelch_wholepkt = 0;
-SYSCTL_ULONG(_net_inet_pim, OID_AUTO, squelch_wholepkt, CTLFLAG_RW,
+SYSCTL_ULONG(_net_inet_pim, OID_AUTO, squelch_wholepkt, CTLFLAG_RWTUN,
     &pim_squelch_wholepkt, 0,
     "Disable IGMP_WHOLEPKT notifications if rendezvous point is unspecified");
 
@@ -2817,18 +2819,12 @@ ip_mroute_modevent(module_t mod, int type, void *unused)
 			return (EINVAL);
 		}
 
-		mfchashsize = MFCHASHSIZE;
-		if (TUNABLE_ULONG_FETCH("net.inet.ip.mfchashsize", &mfchashsize) &&
-				!powerof2(mfchashsize)) {
+		if (!powerof2(mfchashsize)) {
 			printf("WARNING: %s not a power of 2; using default\n",
 					"net.inet.ip.mfchashsize");
 			mfchashsize = MFCHASHSIZE;
 		}
 
-		pim_squelch_wholepkt = 0;
-		TUNABLE_ULONG_FETCH("net.inet.pim.squelch_wholepkt",
-				&pim_squelch_wholepkt);
-
 		pim_encap_cookie = ip_encap_attach(&ipv4_encap_cfg, NULL, M_WAITOK);
 
 		ip_mcast_src = X_ip_mcast_src;



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