Commit 5f9f946b authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nf_conntrack: fix compilation if sysctl are disabled

In (f94161c1 netfilter: nf_conntrack: move initialization out of pernet
operations), some ifdefs were missing for sysctl dependent code.
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent c296bb4d
...@@ -563,10 +563,14 @@ static int __init nf_conntrack_standalone_init(void) ...@@ -563,10 +563,14 @@ static int __init nf_conntrack_standalone_init(void)
if (ret < 0) if (ret < 0)
goto out_start; goto out_start;
#ifdef CONFIG_SYSCTL
nf_ct_netfilter_header = nf_ct_netfilter_header =
register_net_sysctl(&init_net, "net", nf_ct_netfilter_table); register_net_sysctl(&init_net, "net", nf_ct_netfilter_table);
if (!nf_ct_netfilter_header) if (!nf_ct_netfilter_header) {
pr_err("nf_conntrack: can't register to sysctl.\n");
goto out_sysctl; goto out_sysctl;
}
#endif
ret = register_pernet_subsys(&nf_conntrack_net_ops); ret = register_pernet_subsys(&nf_conntrack_net_ops);
if (ret < 0) if (ret < 0)
...@@ -576,9 +580,10 @@ static int __init nf_conntrack_standalone_init(void) ...@@ -576,9 +580,10 @@ static int __init nf_conntrack_standalone_init(void)
return 0; return 0;
out_pernet: out_pernet:
#ifdef CONFIG_SYSCTL
unregister_net_sysctl_table(nf_ct_netfilter_header); unregister_net_sysctl_table(nf_ct_netfilter_header);
out_sysctl: out_sysctl:
pr_err("nf_conntrack: can't register to sysctl.\n"); #endif
nf_conntrack_cleanup_end(); nf_conntrack_cleanup_end();
out_start: out_start:
return ret; return ret;
...@@ -588,7 +593,9 @@ static void __exit nf_conntrack_standalone_fini(void) ...@@ -588,7 +593,9 @@ static void __exit nf_conntrack_standalone_fini(void)
{ {
nf_conntrack_cleanup_start(); nf_conntrack_cleanup_start();
unregister_pernet_subsys(&nf_conntrack_net_ops); unregister_pernet_subsys(&nf_conntrack_net_ops);
#ifdef CONFIG_SYSCTL
unregister_net_sysctl_table(nf_ct_netfilter_header); unregister_net_sysctl_table(nf_ct_netfilter_header);
#endif
nf_conntrack_cleanup_end(); nf_conntrack_cleanup_end();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment