diff mbox

[ovs-dev,V2,3/4] compat: Fix build error in kernels 4.10+

Message ID 1493334794-14665-4-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show

Commit Message

Gregory Rose April 27, 2017, 11:13 p.m. UTC
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 <ray@oneunified.net>
CC: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/linux/compat/ip_fragment.c        | 12 ++++++++++++
 datapath/linux/compat/nf_conntrack_reasm.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

Comments

Guoshuai Li April 28, 2017, 1:33 a.m. UTC | #1
Good. Better than me, learning.

> 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 <ray@oneunified.net>
> CC: Guoshuai Li <ligs@dtdream.com>
> Signed-off-by: Greg Rose <gvrose8192@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;
Joe Stringer April 28, 2017, 9:34 p.m. UTC | #2
On 27 April 2017 at 16:13, Greg Rose <gvrose8192@gmail.com> wrote:
> 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.

In future, please place these version increments below the "---" so
'git apply' will drop them.

>
> Reported-by: Raymond Burkholder <ray@oneunified.net>
> CC: Guoshuai Li <ligs@dtdream.com>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---

Thanks, will apply this to master shortly.
Gregory Rose April 28, 2017, 9:42 p.m. UTC | #3
On Fri, 2017-04-28 at 14:34 -0700, Joe Stringer wrote:
> On 27 April 2017 at 16:13, Greg Rose <gvrose8192@gmail.com> wrote:
> > 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.
> 
> In future, please place these version increments below the "---" so
> 'git apply' will drop them.

OK, sure.  Makes sense because this is a public repository.

Thanks,

- Greg

> 
> >
> > Reported-by: Raymond Burkholder <ray@oneunified.net>
> > CC: Guoshuai Li <ligs@dtdream.com>
> > Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> > ---
> 
> Thanks, will apply this to master shortly.
diff mbox

Patch

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;