On Thu, 2017-04-27 at 13:53 -0700, Jarno Rajahalme wrote:
> > On Apr 27, 2017, at 1:08 PM, Greg Rose <gvrose8...@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.
> > 
> > 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        | 14 ++++++++++++++
> > datapath/linux/compat/nf_conntrack_reasm.c | 14 ++++++++++++++
> > 2 files changed, 28 insertions(+)
> > 
> > diff --git a/datapath/linux/compat/ip_fragment.c 
> > b/datapath/linux/compat/ip_fragment.c
> > index b0f5d0e..fccd992 100644
> > --- a/datapath/linux/compat/ip_fragment.c
> > +++ b/datapath/linux/compat/ip_fragment.c
> > @@ -729,18 +729,32 @@ 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)
> > +{
> > +   nf_defrag_ipv4_enable(net);
> > +
> > +   return 0;
> > +}
> > +#endif
> > +
> 
> Did you consider Joe’s proposal to pass the error return to the caller? If it 
> makes sense, then maybe we could use nf_ functions directly and not define 
> the _init_net() functions at all (as the stubs prototype is the same as the 
> _enable function prototype, except for the “__net_init” attribute)?

I must have missed that.  Let me go back to the list and see if I can
find it.

Thanks for the review!

- Greg

> 
> > 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..701faf5 100644
> > --- a/datapath/linux/compat/nf_conntrack_reasm.c
> > +++ b/datapath/linux/compat/nf_conntrack_reasm.c
> > @@ -558,12 +558,24 @@ out_unlock:
> >     return ret;
> > }
> > 
> > +#ifdef HAVE_DEFRAG_ENABLE_TAKES_NET
> > +static int nf_ct_net_init(struct net *net)
> > +{
> > +   nf_defrag_ipv6_enable(net);
> > +
> > +   return 0;
> > +}
> > +#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 +583,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
> 



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

Reply via email to