summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2016-07-12 15:26:23 -0700
committerJoe Stringer <joe@ovn.org>2016-08-01 14:16:23 -0700
commit5e9c7f2bcf75c2d730b0095d536dfbc39bff6475 (patch)
tree4da3510aea58b73be4d38c6b37bc5e05cc4a91e0
parent78f4537f72cb1cdb4cf851e03477c43a9f7554e5 (diff)
downloadopenvswitch-5e9c7f2bcf75c2d730b0095d536dfbc39bff6475.tar.gz
compat: Only call nf_defrag_ipv[46]_enable() once.
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> Acked-by: Pravin B Shelar <pshelar@ovn.org>
-rw-r--r--datapath/linux/compat/ip_fragment.c9
-rw-r--r--datapath/linux/compat/nf_conntrack_reasm.c9
2 files changed, 2 insertions, 16 deletions
diff --git a/datapath/linux/compat/ip_fragment.c b/datapath/linux/compat/ip_fragment.c
index 4e9c50349..e707c607f 100644
--- a/datapath/linux/compat/ip_fragment.c
+++ b/datapath/linux/compat/ip_fragment.c
@@ -728,25 +728,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 c48459199..a66d00f80 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;