diff mbox

[ovs-dev,6/6] compat: Only call nf_defrag_ipv[46]_enable() once.

Message ID 20160712222623.9079-7-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer July 12, 2016, 10:26 p.m. UTC
This function is just a dummy to ensure that the corresponding netfilter
fragment module is loaded, to initialize the shared structures. But it
doesn't need to be invoked once per namespace; one call per protocol
should do the trick.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 datapath/linux/compat/ip_fragment.c        | 9 +--------
 datapath/linux/compat/nf_conntrack_reasm.c | 9 +--------
 2 files changed, 2 insertions(+), 16 deletions(-)
diff mbox

Patch

diff --git a/datapath/linux/compat/ip_fragment.c b/datapath/linux/compat/ip_fragment.c
index 64e2cf23c327..3b737f304287 100644
--- a/datapath/linux/compat/ip_fragment.c
+++ b/datapath/linux/compat/ip_fragment.c
@@ -725,25 +725,18 @@  int rpl_ip_defrag(struct net *net, struct sk_buff *skb, u32 user)
 	return -ENOMEM;
 }
 
-static int __net_init ipv4_frags_init_net(struct net *net)
-{
-	nf_defrag_ipv4_enable();
-
-	return 0;
-}
-
 static void __net_exit ipv4_frags_exit_net(struct net *net)
 {
 	inet_frags_exit_net(&net->ipv4.frags, &ip4_frags);
 }
 
 static struct pernet_operations ip4_frags_ops = {
-	.init = ipv4_frags_init_net,
 	.exit = ipv4_frags_exit_net,
 };
 
 int __init rpl_ipfrag_init(void)
 {
+	nf_defrag_ipv4_enable();
 	register_pernet_subsys(&ip4_frags_ops);
 	ip4_frags.hashfn = ip4_hashfn;
 	ip4_frags.constructor = ip4_frag_init;
diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c
index c48459199d72..a66d00f8065e 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -556,20 +556,12 @@  out_unlock:
 	return ret;
 }
 
-static int nf_ct_net_init(struct net *net)
-{
-	nf_defrag_ipv6_enable();
-
-	return 0;
-}
-
 static void nf_ct_net_exit(struct net *net)
 {
 	inet_frags_exit_net(&net->nf_frag.frags, &nf_frags);
 }
 
 static struct pernet_operations nf_ct_net_ops = {
-	.init = nf_ct_net_init,
 	.exit = nf_ct_net_exit,
 };
 
@@ -577,6 +569,7 @@  int rpl_nf_ct_frag6_init(void)
 {
 	int ret = 0;
 
+	nf_defrag_ipv6_enable();
 	nf_frags.hashfn = nf_hashfn;
 	nf_frags.constructor = ip6_frag_init;
 	nf_frags.destructor = NULL;