carp: Explicitly mark tunnable net.inet.carp.allow with CTLFLAG_NOFETCH

With recent change 110113bc086f, a vnet tunable can be initialized when
there is a corresponding kernel environment variable unless it is marked
with the flag CTLFLAG_NOFETCH.

The initialization may happen during early boot(linker preload), at that
time vnet0 has not been created. The hander carp_allow_sysctl() for the
tunable net.inet.carp.allow requires vnet, thus invoking it during early
boot will cause kernel panic.

The tunnable is initialized by vnet sysinit routine ipcarp_sysinit() so
let's just mark it with flag CTLFLAG_NOFETCH.

No functional change intended.

Fixes:		110113bc086f sysctl(9): Enable vnet sysctl variables to be loader tunable
MFC after:	2 week
Differential Revision:	https://reviews.freebsd.org/D41525

(cherry picked from commit 242fa308f3c3def32b2e61e0b78c11b3697e4492)
This commit is contained in:
Zhenlei Huang 2023-09-09 16:10:32 +08:00 committed by Franco Fichtner
parent b425fdbd66
commit f4138e6c1e

View File

@ -237,7 +237,7 @@ static int carp_demote_adj_sysctl(SYSCTL_HANDLER_ARGS);
SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"CARP");
SYSCTL_PROC(_net_inet_carp, OID_AUTO, allow,
CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE,
&VNET_NAME(carp_allow), 0, carp_allow_sysctl, "I",
"Accept incoming CARP packets");
SYSCTL_PROC(_net_inet_carp, OID_AUTO, dscp,