diff mbox

[ovs-dev] compat: Fix build error in kernel 4.10.0

Message ID CAPWQB7F-TGmcTNc0mC2TbTx_sFm33jWD_UiBkEa9vfoWdOOqBg@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Joe Stringer April 27, 2017, 1:12 a.m. UTC
On 25 April 2017 at 10:00, Greg Rose <gvrose8192@gmail.com> wrote:
> On Tue, 2017-04-25 at 23:26 +0800, Guoshuai Li wrote:
>> In kernel 4.10.0, the function "nf_defrag_ipv6_enable" need
>> parameters "struct net *", so we need call it for each namespace init
>> to load netfilter fragment kmod.
>>
>> Reported-by: Raymond Burkholder <ray@oneunified.net>
>> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/331411.html
>> Signed-off-by: Guoshuai Li <ligs@dtdream.com>
>
> Compile tested and looks OK to me.
>
> Reviewed-by: Greg Rose <gvrose8192@gmail.com>

Thanks all, I'm considering rolling the following incremental into
this patch, does this make sense?

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

Comments

Guoshuai Li April 27, 2017, 1:44 a.m. UTC | #1
> Thanks all, I'm considering rolling the following incremental into
> this patch, does this make sense?
looks good to me ~~
> diff --git a/datapath/linux/compat/ip_fragment.c
> b/datapath/linux/compat/ip_fragment.c
> index efa86fcfae1b..de08f6c6744e 100644
> --- a/datapath/linux/compat/ip_fragment.c
> +++ b/datapath/linux/compat/ip_fragment.c
> @@ -732,9 +732,7 @@ int rpl_ip_defrag(struct net *net, struct sk_buff
> *skb, u32 user)
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
> static int __net_init ipv4_frags_init_net(struct net *net)
> {
> -       nf_defrag_ipv4_enable(net);
> -
> -       return 0;
> +       return nf_defrag_ipv4_enable(net);
> }
> #endif
>
> diff --git a/datapath/linux/compat/nf_conntrack_reasm.c
> b/datapath/linux/compat/nf_conntrack_reasm.c
> index cb6da6c64e05..5832fead800e 100644
> --- a/datapath/linux/compat/nf_conntrack_reasm.c
> +++ b/datapath/linux/compat/nf_conntrack_reasm.c
> @@ -561,9 +561,7 @@ out_unlock:
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
> static int nf_ct_net_init(struct net *net)
> {
> -       nf_defrag_ipv6_enable(net);
> -
> -       return 0;
> +       return nf_defrag_ipv6_enable(net);
> }
> #endif
Andy Zhou April 27, 2017, 2:19 a.m. UTC | #2
On Wed, Apr 26, 2017 at 6:12 PM, Joe Stringer <joe@ovn.org> wrote:
> On 25 April 2017 at 10:00, Greg Rose <gvrose8192@gmail.com> wrote:
>> On Tue, 2017-04-25 at 23:26 +0800, Guoshuai Li wrote:
>>> In kernel 4.10.0, the function "nf_defrag_ipv6_enable" need
>>> parameters "struct net *", so we need call it for each namespace init
>>> to load netfilter fragment kmod.
>>>
>>> Reported-by: Raymond Burkholder <ray@oneunified.net>
>>> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/331411.html
>>> Signed-off-by: Guoshuai Li <ligs@dtdream.com>
>>
>> Compile tested and looks OK to me.
>>
>> Reviewed-by: Greg Rose <gvrose8192@gmail.com>
>
> Thanks all, I'm considering rolling the following incremental into
> this patch, does this make sense?
>
In general, we try not to rely on kernel version number. In this case,
does it make sense to look at the signature of
nf_defrag_ipv{4|6}_enable instead?
Guoshuai Li April 27, 2017, 3:15 a.m. UTC | #3
I try remove "nf_defrag_ipv{4|6}_enabl",  and then test by lsmod:

stack@devstack:~$ lsmod | grep defrag
nf_defrag_ipv6         36864  1 nf_conntrack_ipv6
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4

stack@devstack:~$ lsmod | grep conntrack
nf_conntrack_ipv6      20480  1
nf_defrag_ipv6         36864  1 nf_conntrack_ipv6
nf_conntrack_ipv4      16384  5
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4


without remove, nf_defrag_ipv6 is used by openvswitch:

stack@devstack:~/neutron$ lsmod | grep defrag
nf_defrag_ipv6         36864  2 openvswitch,nf_conntrack_ipv6
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4


Normally, defrag will be loaded, but is not sure whether it is absolute.


> In general, we try not to rely on kernel version number. In this case,
> does it make sense to look at the signature of
> nf_defrag_ipv{4|6}_enable instead?
diff mbox

Patch

diff --git a/datapath/linux/compat/ip_fragment.c
b/datapath/linux/compat/ip_fragment.c
index efa86fcfae1b..de08f6c6744e 100644
--- a/datapath/linux/compat/ip_fragment.c
+++ b/datapath/linux/compat/ip_fragment.c
@@ -732,9 +732,7 @@  int rpl_ip_defrag(struct net *net, struct sk_buff
*skb, u32 user)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
static int __net_init ipv4_frags_init_net(struct net *net)
{
-       nf_defrag_ipv4_enable(net);
-
-       return 0;
+       return nf_defrag_ipv4_enable(net);
}
#endif

diff --git a/datapath/linux/compat/nf_conntrack_reasm.c
b/datapath/linux/compat/nf_conntrack_reasm.c
index cb6da6c64e05..5832fead800e 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -561,9 +561,7 @@  out_unlock:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
static int nf_ct_net_init(struct net *net)
{
-       nf_defrag_ipv6_enable(net);
-
-       return 0;
+       return nf_defrag_ipv6_enable(net);
}
#endif
_______________________________________________