Commit 67f28216 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: conntrack: move autoassign_helper sysctl to net_generic data

While at it, make it an u8, no need to use an integer for a boolean.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 098b5d35
...@@ -45,6 +45,7 @@ union nf_conntrack_expect_proto { ...@@ -45,6 +45,7 @@ union nf_conntrack_expect_proto {
struct nf_conntrack_net { struct nf_conntrack_net {
/* only used when new connection is allocated: */ /* only used when new connection is allocated: */
u8 sysctl_auto_assign_helper;
bool auto_assign_helper_warned; bool auto_assign_helper_warned;
/* only used from work queues, configuration plane, and so on: */ /* only used from work queues, configuration plane, and so on: */
......
...@@ -216,7 +216,7 @@ nf_ct_lookup_helper(struct nf_conn *ct, struct net *net) ...@@ -216,7 +216,7 @@ nf_ct_lookup_helper(struct nf_conn *ct, struct net *net)
{ {
struct nf_conntrack_net *cnet = net_generic(net, nf_conntrack_net_id); struct nf_conntrack_net *cnet = net_generic(net, nf_conntrack_net_id);
if (!net->ct.sysctl_auto_assign_helper) { if (!cnet->sysctl_auto_assign_helper) {
if (cnet->auto_assign_helper_warned) if (cnet->auto_assign_helper_warned)
return NULL; return NULL;
if (!__nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple)) if (!__nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple))
...@@ -560,7 +560,9 @@ static const struct nf_ct_ext_type helper_extend = { ...@@ -560,7 +560,9 @@ static const struct nf_ct_ext_type helper_extend = {
void nf_conntrack_helper_pernet_init(struct net *net) void nf_conntrack_helper_pernet_init(struct net *net)
{ {
net->ct.sysctl_auto_assign_helper = nf_ct_auto_assign_helper; struct nf_conntrack_net *cnet = net_generic(net, nf_conntrack_net_id);
cnet->sysctl_auto_assign_helper = nf_ct_auto_assign_helper;
} }
int nf_conntrack_helper_init(void) int nf_conntrack_helper_init(void)
......
...@@ -662,10 +662,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -662,10 +662,9 @@ static struct ctl_table nf_ct_sysctl_table[] = {
}, },
[NF_SYSCTL_CT_HELPER] = { [NF_SYSCTL_CT_HELPER] = {
.procname = "nf_conntrack_helper", .procname = "nf_conntrack_helper",
.data = &init_net.ct.sysctl_auto_assign_helper, .maxlen = sizeof(u8),
.maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE, .extra2 = SYSCTL_ONE,
}, },
...@@ -1042,7 +1041,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net) ...@@ -1042,7 +1041,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
table[NF_SYSCTL_CT_CHECKSUM].data = &net->ct.sysctl_checksum; table[NF_SYSCTL_CT_CHECKSUM].data = &net->ct.sysctl_checksum;
table[NF_SYSCTL_CT_LOG_INVALID].data = &net->ct.sysctl_log_invalid; table[NF_SYSCTL_CT_LOG_INVALID].data = &net->ct.sysctl_log_invalid;
table[NF_SYSCTL_CT_ACCT].data = &net->ct.sysctl_acct; table[NF_SYSCTL_CT_ACCT].data = &net->ct.sysctl_acct;
table[NF_SYSCTL_CT_HELPER].data = &net->ct.sysctl_auto_assign_helper; table[NF_SYSCTL_CT_HELPER].data = &cnet->sysctl_auto_assign_helper;
#ifdef CONFIG_NF_CONNTRACK_EVENTS #ifdef CONFIG_NF_CONNTRACK_EVENTS
table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events; table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events;
#endif #endif
......
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