This is an alternative solution patch for the issue reported by
Raymond Burkholder and the patch submitted by Guoshuai Li.  It uses
the acinclude.m4 configuration file to check for the net parameter
that was added  to the ipv4 and ipv6 frags init functions in the 4.10
Linux kernel to check whether DEFRAG_ENABLE_TAKES_NET should be
set and then checks for that at compile time.

V2 - Incorporate suggestion from Joe Stringer to just return values
     of the init functions.

Reported-by: Raymond Burkholder <r...@oneunified.net>
CC: Guoshuai Li <l...@dtdream.com>
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 datapath/linux/compat/ip_fragment.c        | 12 ++++++++++++
 datapath/linux/compat/nf_conntrack_reasm.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/datapath/linux/compat/ip_fragment.c 
b/datapath/linux/compat/ip_fragment.c
index b0f5d0e..47b51b5 100644
--- a/datapath/linux/compat/ip_fragment.c
+++ b/datapath/linux/compat/ip_fragment.c
@@ -729,18 +729,30 @@ int rpl_ip_defrag(struct net *net, struct sk_buff *skb, 
u32 user)
        return -ENOMEM;
 }
 
+#ifdef HAVE_DEFRAG_ENABLE_TAKES_NET
+static int __net_init ipv4_frags_init_net(struct net *net)
+{
+       return nf_defrag_ipv4_enable(net);
+}
+#endif
+
 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 = {
+#ifdef HAVE_DEFRAG_ENABLE_TAKES_NET
+       .init = ipv4_frags_init_net,
+#endif
        .exit = ipv4_frags_exit_net,
 };
 
 int __init rpl_ipfrag_init(void)
 {
+#ifndef HAVE_DEFRAG_ENABLE_TAKES_NET
        nf_defrag_ipv4_enable();
+#endif
        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 0bc4d9e..0da9463 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -558,12 +558,22 @@ out_unlock:
        return ret;
 }
 
+#ifdef HAVE_DEFRAG_ENABLE_TAKES_NET
+static int nf_ct_net_init(struct net *net)
+{
+       return nf_defrag_ipv6_enable(net);
+}
+#endif
+
 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 = {
+#ifdef HAVE_DEFRAG_ENABLE_TAKES_NET
+       .init = nf_ct_net_init,
+#endif
        .exit = nf_ct_net_exit,
 };
 
@@ -571,7 +581,9 @@ int rpl_nf_ct_frag6_init(void)
 {
        int ret = 0;
 
+#ifndef HAVE_DEFRAG_ENABLE_TAKES_NET
        nf_defrag_ipv6_enable();
+#endif
        nf_frags.hashfn = nf_hashfn;
        nf_frags.constructor = ip6_frag_init;
        nf_frags.destructor = NULL;
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to