net: ignore sysctl_devconf_inherit_init_net without SYSCTL

When CONFIG_SYSCTL is turned off, we get a link failure for
the newly introduced tuning knob.

net/ipv6/addrconf.o: In function `addrconf_init_net':
addrconf.c:(.text+0x31dc): undefined reference to `sysctl_devconf_inherit_init_net'

Add an IS_ENABLED() check to fall back to the default behavior
(sysctl_devconf_inherit_init_net=0) here.

Fixes: 856c395cfa ("net: introduce a knob to control whether to inherit devconf config")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arnd Bergmann 2019-03-04 21:38:03 +01:00 committed by David S. Miller
parent 64af7dc35f
commit a154d5d83d
2 changed files with 5 additions and 2 deletions

View File

@ -2614,7 +2614,9 @@ static __net_init int devinet_init_net(struct net *net)
tbl[0].extra2 = net; tbl[0].extra2 = net;
#endif #endif
if (sysctl_devconf_inherit_init_net != 2 && !net_eq(net, &init_net)) { if ((!IS_ENABLED(CONFIG_SYSCTL) ||
sysctl_devconf_inherit_init_net != 2) &&
!net_eq(net, &init_net)) {
memcpy(all, init_net.ipv4.devconf_all, sizeof(ipv4_devconf)); memcpy(all, init_net.ipv4.devconf_all, sizeof(ipv4_devconf));
memcpy(dflt, init_net.ipv4.devconf_dflt, sizeof(ipv4_devconf_dflt)); memcpy(dflt, init_net.ipv4.devconf_dflt, sizeof(ipv4_devconf_dflt));
} }

View File

@ -6905,7 +6905,8 @@ static int __net_init addrconf_init_net(struct net *net)
if (!dflt) if (!dflt)
goto err_alloc_dflt; goto err_alloc_dflt;
if (sysctl_devconf_inherit_init_net == 1 && !net_eq(net, &init_net)) { if (IS_ENABLED(CONFIG_SYSCTL) &&
sysctl_devconf_inherit_init_net == 1 && !net_eq(net, &init_net)) {
memcpy(all, init_net.ipv6.devconf_all, sizeof(ipv6_devconf)); memcpy(all, init_net.ipv6.devconf_all, sizeof(ipv6_devconf));
memcpy(dflt, init_net.ipv6.devconf_dflt, sizeof(ipv6_devconf_dflt)); memcpy(dflt, init_net.ipv6.devconf_dflt, sizeof(ipv6_devconf_dflt));
} }