summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifeng Sun <pkusunyifeng@gmail.com>2019-05-24 11:24:25 -0700
committerBen Pfaff <blp@ovn.org>2019-06-07 12:10:29 -0700
commit88a28bbe5959a09d99d15ee2e6ee4714f9682ce8 (patch)
treec7346e54ee1585bd788c99849d41354ea6292182
parentc9dc050d2078fa9b914055c89c403d44e9626307 (diff)
downloadopenvswitch-88a28bbe5959a09d99d15ee2e6ee4714f9682ce8.tar.gz
datapath: Fix build errors for 4.9.172+ kernels
4.9.172+ kernel backported upstream patch 70b095c843266 ("ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module") and this caused compilation errors of OVS kernel module. This patch fixes it by checking and using new functions introduced by the upstream patch. Travis tests passed at https://travis-ci.org/yifsun/ovs-travis/builds/536527230 with latest Linux kernel version. In addition, this patch doesn't introduce failed tests for latest kernels of Ubuntu (bionic, trusty, xenial), fedora, centos 73, rhel (74, 75, 76). Reported-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--datapath/linux/compat/nf_conntrack_reasm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c
index 9d77d9827..ced9fba98 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -41,6 +41,7 @@
#include <net/inet_frag.h>
#include <net/ipv6.h>
+#include <net/ipv6_frag.h>
#include <net/protocol.h>
#include <net/transp_v6.h>
#include <net/rawv6.h>
@@ -138,8 +139,12 @@ static void nf_ct_frag6_expire(unsigned long data)
#ifdef HAVE_INET_FRAGS_RND
ip6_expire_frag_queue(net, fq, &nf_frags);
#else
+#ifdef HAVE_IPV6_FRAG_H
+ ip6frag_expire_frag_queue(net, fq);
+#else
ip6_expire_frag_queue(net, fq);
#endif
+#endif
}
#ifdef HAVE_INET_FRAGS_RND
@@ -673,6 +678,16 @@ static struct pernet_operations nf_ct_net_ops = {
.exit = nf_ct_net_exit,
};
+#ifdef HAVE_IPV6_FRAG_H
+static const struct rhashtable_params nfct_rhash_params = {
+ .head_offset = offsetof(struct inet_frag_queue, node),
+ .hashfn = ip6frag_key_hashfn,
+ .obj_hashfn = ip6frag_obj_hashfn,
+ .obj_cmpfn = ip6frag_obj_cmpfn,
+ .automatic_shrinking = true,
+};
+#endif
+
int rpl_nf_ct_frag6_init(void)
{
int ret = 0;
@@ -683,10 +698,16 @@ int rpl_nf_ct_frag6_init(void)
#ifdef HAVE_INET_FRAGS_RND
nf_frags.hashfn = nf_hashfn;
nf_frags.match = ip6_frag_match;
+ nf_frags.constructor = ip6_frag_init;
+#else
+#ifdef HAVE_IPV6_FRAG_H
+ nf_frags.rhash_params = nfct_rhash_params;
+ nf_frags.constructor = ip6frag_init;
#else
nf_frags.rhash_params = ip6_rhash_params;
-#endif
nf_frags.constructor = ip6_frag_init;
+#endif
+#endif /* HAVE_INET_FRAGS_RND */
nf_frags.destructor = NULL;
nf_frags.qsize = sizeof(struct frag_queue);
nf_frags.frag_expire = nf_ct_frag6_expire;