diff mbox series

[ovs-dev,3/7,v3] datapath: Use new header filenet/ipv6_frag.h

Message ID 1557516614-12563-4-git-send-email-pkusunyifeng@gmail.com
State Accepted
Commit 7857a9b4fcdb2679687b8a1a0e0f666ee3bbba6b
Headers show
Series datapath: Support 4.19.x and 4.20.x kernel | expand

Commit Message

Yifeng Sun May 10, 2019, 7:30 p.m. UTC
From: Florian Westphal <fw@strlen.de>

Upstream commit:
    commit 70b095c84326640eeacfd69a411db8fc36e8ab1a
    Author: Florian Westphal <fw@strlen.de>
    Date:   Sat Jul 14 01:14:01 2018 +0200

    ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module

    IPV6=m
    DEFRAG_IPV6=m
    CONNTRACK=y yields:

    net/netfilter/nf_conntrack_proto.o: In function `nf_ct_netns_do_get':
    net/netfilter/nf_conntrack_proto.c:802: undefined reference to `nf_defrag_ipv6_enable'
    net/netfilter/nf_conntrack_proto.o:(.rodata+0x640): undefined reference to `nf_conntrack_l4proto_icmpv6'

    Setting DEFRAG_IPV6=y causes undefined references to ip6_rhash_params
    ip6_frag_init and ip6_expire_frag_queue so it would be needed to force
    IPV6=y too.

    This patch gets rid of the 'followup linker error' by removing
    the dependency of ipv6.ko symbols from netfilter ipv6 defrag.

    Shared code is placed into a header, then used from both.

    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

This patch backports the above upstream patch to OVS.

Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 acinclude.m4                                  | 2 ++
 datapath/conntrack.c                          | 1 +
 datapath/linux/Modules.mk                     | 1 +
 datapath/linux/compat/include/net/ipv6_frag.h | 8 ++++++++
 4 files changed, 12 insertions(+)
 create mode 100644 datapath/linux/compat/include/net/ipv6_frag.h

Comments

Ilya Maximets May 17, 2019, 10:08 a.m. UTC | #1
On 10.05.2019 22:30, Yifeng Sun wrote:
> From: Florian Westphal <fw@strlen.de>
> 
> Upstream commit:
>     commit 70b095c84326640eeacfd69a411db8fc36e8ab1a
>     Author: Florian Westphal <fw@strlen.de>
>     Date:   Sat Jul 14 01:14:01 2018 +0200
> 
>     ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module
> 
>     IPV6=m
>     DEFRAG_IPV6=m
>     CONNTRACK=y yields:
> 
>     net/netfilter/nf_conntrack_proto.o: In function `nf_ct_netns_do_get':
>     net/netfilter/nf_conntrack_proto.c:802: undefined reference to `nf_defrag_ipv6_enable'
>     net/netfilter/nf_conntrack_proto.o:(.rodata+0x640): undefined reference to `nf_conntrack_l4proto_icmpv6'
> 
>     Setting DEFRAG_IPV6=y causes undefined references to ip6_rhash_params
>     ip6_frag_init and ip6_expire_frag_queue so it would be needed to force
>     IPV6=y too.
> 
>     This patch gets rid of the 'followup linker error' by removing
>     the dependency of ipv6.ko symbols from netfilter ipv6 defrag.
> 
>     Shared code is placed into a header, then used from both.
> 
>     Signed-off-by: Florian Westphal <fw@strlen.de>
>     Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> This patch backports the above upstream patch to OVS.
> 
> Cc: Florian Westphal <fw@strlen.de>
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
> ---
>  acinclude.m4                                  | 2 ++
>  datapath/conntrack.c                          | 1 +
>  datapath/linux/Modules.mk                     | 1 +
>  datapath/linux/compat/include/net/ipv6_frag.h | 8 ++++++++
>  4 files changed, 12 insertions(+)
>  create mode 100644 datapath/linux/compat/include/net/ipv6_frag.h
> 

Hi. This seems like not a full set of required changes.
This patch doesn't fix the compat implementation of nf_conntrack_reasm.c:
    datapath/linux/compat/nf_conntrack_reasm.c
It uses 'struct frag_queue' that was moved to a new header and some functions
and structures like 'ip6_frag_init'  and 'ip6_rhash_params'.
In practice we have a broken build with kernel 4.9.176 where the same upstream
patch was backported.

I'll be good if someone could take care of this.

BTW, I have a patch for TravisCI to always check with the latest stable versions,
i.e. if KERNEL=4.9 specified in matrix, Travis will check the latest 4.9.x and
will try to build with it. Would like to hear if this is an interesting feature
or not.

Best regards, Ilya Maximets.
Yifeng Sun May 17, 2019, 5:51 p.m. UTC | #2
Hi Ilya,

Thanks for the checking. Present travis is using 4.9.171 and build passed.
I will check out the reason why it breaks for 4.9.176.

You patch for TravisCI is great, thank you for that!

Thanks,
Yifeng

On Fri, May 17, 2019 at 3:08 AM Ilya Maximets <i.maximets@samsung.com> wrote:
>
> On 10.05.2019 22:30, Yifeng Sun wrote:
> > From: Florian Westphal <fw@strlen.de>
> >
> > Upstream commit:
> >     commit 70b095c84326640eeacfd69a411db8fc36e8ab1a
> >     Author: Florian Westphal <fw@strlen.de>
> >     Date:   Sat Jul 14 01:14:01 2018 +0200
> >
> >     ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module
> >
> >     IPV6=m
> >     DEFRAG_IPV6=m
> >     CONNTRACK=y yields:
> >
> >     net/netfilter/nf_conntrack_proto.o: In function `nf_ct_netns_do_get':
> >     net/netfilter/nf_conntrack_proto.c:802: undefined reference to `nf_defrag_ipv6_enable'
> >     net/netfilter/nf_conntrack_proto.o:(.rodata+0x640): undefined reference to `nf_conntrack_l4proto_icmpv6'
> >
> >     Setting DEFRAG_IPV6=y causes undefined references to ip6_rhash_params
> >     ip6_frag_init and ip6_expire_frag_queue so it would be needed to force
> >     IPV6=y too.
> >
> >     This patch gets rid of the 'followup linker error' by removing
> >     the dependency of ipv6.ko symbols from netfilter ipv6 defrag.
> >
> >     Shared code is placed into a header, then used from both.
> >
> >     Signed-off-by: Florian Westphal <fw@strlen.de>
> >     Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> >
> > This patch backports the above upstream patch to OVS.
> >
> > Cc: Florian Westphal <fw@strlen.de>
> > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> > Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
> > ---
> >  acinclude.m4                                  | 2 ++
> >  datapath/conntrack.c                          | 1 +
> >  datapath/linux/Modules.mk                     | 1 +
> >  datapath/linux/compat/include/net/ipv6_frag.h | 8 ++++++++
> >  4 files changed, 12 insertions(+)
> >  create mode 100644 datapath/linux/compat/include/net/ipv6_frag.h
> >
>
> Hi. This seems like not a full set of required changes.
> This patch doesn't fix the compat implementation of nf_conntrack_reasm.c:
>     datapath/linux/compat/nf_conntrack_reasm.c
> It uses 'struct frag_queue' that was moved to a new header and some functions
> and structures like 'ip6_frag_init'  and 'ip6_rhash_params'.
> In practice we have a broken build with kernel 4.9.176 where the same upstream
> patch was backported.
>
> I'll be good if someone could take care of this.
>
> BTW, I have a patch for TravisCI to always check with the latest stable versions,
> i.e. if KERNEL=4.9 specified in matrix, Travis will check the latest 4.9.x and
> will try to build with it. Would like to hear if this is an interesting feature
> or not.
>
> Best regards, Ilya Maximets.
Ilya Maximets May 18, 2019, 7:40 a.m. UTC | #3
On 17.05.2019 20:51, Yifeng Sun wrote:
> Hi Ilya,
> 
> Thanks for the checking. Present travis is using 4.9.171 and build passed.
> I will check out the reason why it breaks for 4.9.176.

Thanks.

> 
> You patch for TravisCI is great, thank you for that!

Thanks. I'll send it to the list on Monday.

> 
> Thanks,
> Yifeng
> 
> On Fri, May 17, 2019 at 3:08 AM Ilya Maximets <i.maximets@samsung.com> wrote:
>>
>> On 10.05.2019 22:30, Yifeng Sun wrote:
>>> From: Florian Westphal <fw@strlen.de>
>>>
>>> Upstream commit:
>>>     commit 70b095c84326640eeacfd69a411db8fc36e8ab1a
>>>     Author: Florian Westphal <fw@strlen.de>
>>>     Date:   Sat Jul 14 01:14:01 2018 +0200
>>>
>>>     ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module
>>>
>>>     IPV6=m
>>>     DEFRAG_IPV6=m
>>>     CONNTRACK=y yields:
>>>
>>>     net/netfilter/nf_conntrack_proto.o: In function `nf_ct_netns_do_get':
>>>     net/netfilter/nf_conntrack_proto.c:802: undefined reference to `nf_defrag_ipv6_enable'
>>>     net/netfilter/nf_conntrack_proto.o:(.rodata+0x640): undefined reference to `nf_conntrack_l4proto_icmpv6'
>>>
>>>     Setting DEFRAG_IPV6=y causes undefined references to ip6_rhash_params
>>>     ip6_frag_init and ip6_expire_frag_queue so it would be needed to force
>>>     IPV6=y too.
>>>
>>>     This patch gets rid of the 'followup linker error' by removing
>>>     the dependency of ipv6.ko symbols from netfilter ipv6 defrag.
>>>
>>>     Shared code is placed into a header, then used from both.
>>>
>>>     Signed-off-by: Florian Westphal <fw@strlen.de>
>>>     Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
>>>
>>> This patch backports the above upstream patch to OVS.
>>>
>>> Cc: Florian Westphal <fw@strlen.de>
>>> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
>>> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
>>> ---
>>>  acinclude.m4                                  | 2 ++
>>>  datapath/conntrack.c                          | 1 +
>>>  datapath/linux/Modules.mk                     | 1 +
>>>  datapath/linux/compat/include/net/ipv6_frag.h | 8 ++++++++
>>>  4 files changed, 12 insertions(+)
>>>  create mode 100644 datapath/linux/compat/include/net/ipv6_frag.h
>>>
>>
>> Hi. This seems like not a full set of required changes.
>> This patch doesn't fix the compat implementation of nf_conntrack_reasm.c:
>>     datapath/linux/compat/nf_conntrack_reasm.c
>> It uses 'struct frag_queue' that was moved to a new header and some functions
>> and structures like 'ip6_frag_init'  and 'ip6_rhash_params'.
>> In practice we have a broken build with kernel 4.9.176 where the same upstream
>> patch was backported.
>>
>> I'll be good if someone could take care of this.
>>
>> BTW, I have a patch for TravisCI to always check with the latest stable versions,
>> i.e. if KERNEL=4.9 specified in matrix, Travis will check the latest 4.9.x and
>> will try to build with it. Would like to hear if this is an interesting feature
>> or not.
>>
>> Best regards, Ilya Maximets.
> 
>
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 372be5f4dccd..4f9aebc325ba 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -934,6 +934,8 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_core.h],
                         [nf_conntrack_in], [nf_hook_state],
                         [OVS_DEFINE([HAVE_NF_CONNTRACK_IN_TAKES_NF_HOOK_STATE])])
+  OVS_GREP_IFELSE([$KSRC/include/net/ipv6_frag.h], [IP6_DEFRAG_CONNTRACK_IN],
+                  [OVS_DEFINE([HAVE_IPV6_FRAG_H])])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index 8c1a80308d6a..52825a6b20fb 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -31,6 +31,7 @@ 
 #include <net/netfilter/nf_conntrack_seqadj.h>
 #include <net/netfilter/nf_conntrack_zones.h>
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
+#include <net/ipv6_frag.h>
 
 #ifdef CONFIG_NF_NAT_NEEDED
 #include <linux/netfilter/nf_nat.h>
diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index ae63e3653b41..cbb29f1c69d0 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -86,6 +86,7 @@  openvswitch_headers += \
 	linux/compat/include/net/ip6_route.h \
 	linux/compat/include/net/ip6_tunnel.h \
 	linux/compat/include/net/ipv6.h \
+	linux/compat/include/net/ipv6_frag.h \
 	linux/compat/include/net/mpls.h \
 	linux/compat/include/net/net_namespace.h \
 	linux/compat/include/net/netlink.h \
diff --git a/datapath/linux/compat/include/net/ipv6_frag.h b/datapath/linux/compat/include/net/ipv6_frag.h
new file mode 100644
index 000000000000..5d1cc901bec1
--- /dev/null
+++ b/datapath/linux/compat/include/net/ipv6_frag.h
@@ -0,0 +1,8 @@ 
+#ifndef __NET_IPV6_FRAG_WRAPPER_H
+#define __NET_IPV6_FRAG_WRAPPER_H
+
+#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) && defined(HAVE_IPV6_FRAG_H)
+#include_next <net/ipv6_frag.h>
+#endif
+
+#endif /* __NET_IPV6_FRAG_WRAPPER_H */