From acca35d460e9c8dfca369641fcee0f41e8cd259d Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 29 Jul 2020 11:55:04 +0800 Subject: [PATCH] openvswitch: backport patch fixing build for 4.14.187 Supersedes openwrt/packages#12932 Signed-off-by: Yousong Zhou --- net/openvswitch/Makefile | 2 +- ...mpat-Fix-ipv6_dst_lookup-build-error.patch | 98 ++++++++++++++++ ...008-compat-Backport-ipv6_stub-change.patch | 106 ++++++++++++++++++ 3 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 net/openvswitch/patches/0007-compat-Fix-ipv6_dst_lookup-build-error.patch create mode 100644 net/openvswitch/patches/0008-compat-Backport-ipv6_stub-change.patch diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile index bc690ed45b..2a9f34227e 100644 --- a/net/openvswitch/Makefile +++ b/net/openvswitch/Makefile @@ -17,7 +17,7 @@ include ./openvswitch.mk # PKG_NAME:=openvswitch PKG_VERSION:=$(ovs_version) -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.openvswitch.org/releases/ PKG_HASH:=dd5f727427e36cab22bdeae61529d8c8fccacc53d968cfa7658f7f935ddda531 diff --git a/net/openvswitch/patches/0007-compat-Fix-ipv6_dst_lookup-build-error.patch b/net/openvswitch/patches/0007-compat-Fix-ipv6_dst_lookup-build-error.patch new file mode 100644 index 0000000000..2539f749c9 --- /dev/null +++ b/net/openvswitch/patches/0007-compat-Fix-ipv6_dst_lookup-build-error.patch @@ -0,0 +1,98 @@ +From ab78cc673ebf8e13558fdde459d74538e8cf0760 Mon Sep 17 00:00:00 2001 +From: Yi-Hung Wei +Date: Wed, 29 Apr 2020 14:25:50 -0700 +Subject: [PATCH] compat: Fix ipv6_dst_lookup build error + +The geneve/vxlan compat code base invokes ipv6_dst_lookup() which is +recently replaced by ipv6_dst_lookup_flow() in the stable kernel tree. + +This causes travis build failure: + * https://travis-ci.org/github/openvswitch/ovs/builds/681084038 + +This patch updates the backport logic to invoke the right function. + +Related patch in + git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git + +b9f3e457098e ("net: ipv6_stub: use ip6_dst_lookup_flow instead of + ip6_dst_lookup") + +Signed-off-by: Yi-Hung Wei +Signed-off-by: William Tu +--- + acinclude.m4 | 3 +++ + datapath/linux/compat/geneve.c | 11 +++++++---- + datapath/linux/compat/vxlan.c | 14 ++++++++------ + 3 files changed, 18 insertions(+), 10 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index c1470ccc6..ebe8b43b5 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -569,7 +569,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ + + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net], + [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])]) ++ OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net], ++ [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_FLOW_NET])]) + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub]) ++ OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow]) + + OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST]) + OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL]) +diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c +index c044b1489..4bdab6836 100644 +--- a/datapath/linux/compat/geneve.c ++++ b/datapath/linux/compat/geneve.c +@@ -962,14 +962,17 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, + return dst; + } + +-#ifdef HAVE_IPV6_DST_LOOKUP_NET ++#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) ++ if (ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, &dst, ++ fl6)) { ++#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW) ++ if (ipv6_stub->ipv6_dst_lookup_flow(gs6->sock->sk, &dst, fl6)) { ++#elif defined(HAVE_IPV6_DST_LOOKUP_NET) + if (ipv6_stub->ipv6_dst_lookup(geneve->net, gs6->sock->sk, &dst, fl6)) { +-#else +-#ifdef HAVE_IPV6_STUB ++#elif defined(HAVE_IPV6_STUB) + if (ipv6_stub->ipv6_dst_lookup(gs6->sock->sk, &dst, fl6)) { + #else + if (ip6_dst_lookup(gs6->sock->sk, &dst, fl6)) { +-#endif + #endif + netdev_dbg(dev, "no route to %pI6\n", &fl6->daddr); + return ERR_PTR(-ENETUNREACH); +diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c +index 23118e8b6..ff10ae6f4 100644 +--- a/datapath/linux/compat/vxlan.c ++++ b/datapath/linux/compat/vxlan.c +@@ -990,17 +990,19 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + fl6.fl6_dport = dport; + fl6.fl6_sport = sport; + +-#ifdef HAVE_IPV6_DST_LOOKUP_NET +- err = ipv6_stub->ipv6_dst_lookup(vxlan->net, +- sock6->sock->sk, ++#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) ++ err = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk, ++ &ndst, &fl6); ++#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW) ++ err = ipv6_stub->ipv6_dst_lookup_flow(sock6->sock->sk, &ndst, &fl6); ++#elif defined(HAVE_IPV6_DST_LOOKUP_NET) ++ err = ipv6_stub->ipv6_dst_lookup(vxlan->net, sock6->sock->sk, + &ndst, &fl6); +-#else +-#ifdef HAVE_IPV6_STUB ++#elif defined(HAVE_IPV6_STUB) + err = ipv6_stub->ipv6_dst_lookup(vxlan->vn6_sock->sock->sk, + &ndst, &fl6); + #else + err = ip6_dst_lookup(vxlan->vn6_sock->sock->sk, &ndst, &fl6); +-#endif + #endif + if (err < 0) + return ERR_PTR(err); diff --git a/net/openvswitch/patches/0008-compat-Backport-ipv6_stub-change.patch b/net/openvswitch/patches/0008-compat-Backport-ipv6_stub-change.patch new file mode 100644 index 0000000000..aa0e33ec62 --- /dev/null +++ b/net/openvswitch/patches/0008-compat-Backport-ipv6_stub-change.patch @@ -0,0 +1,106 @@ +From 28f52edd7f6978fcd97442312122543bae32597d Mon Sep 17 00:00:00 2001 +From: Greg Rose +Date: Thu, 21 May 2020 14:54:03 -0700 +Subject: [PATCH] compat: Backport ipv6_stub change + +A patch backported to the Linux stable 4.14 tree and present in the +latest stable 4.14.181 kernel breaks ipv6_stub usage. + +The commit is +8ab8786f78c3 ("net ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup"). + +Create the compat layer define to check for it and fixup usage in vxlan +and geneve modules. + +Passes Travis here: +https://travis-ci.org/github/gvrose8192/ovs-experimental/builds/689798733 + +Signed-off-by: Greg Rose +Signed-off-by: William Tu +--- + acinclude.m4 | 2 ++ + datapath/linux/compat/geneve.c | 11 ++++++++++- + datapath/linux/compat/vxlan.c | 18 +++++++++++++++++- + 3 files changed, 29 insertions(+), 2 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index ebe8b43b5..c47a77ed6 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -567,6 +567,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ + OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6_get_cookie], + [OVS_DEFINE([HAVE_RT6_GET_COOKIE])]) + ++ OVS_FIND_FIELD_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub], ++ [dst_entry]) + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net], + [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])]) + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net], +diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c +index 4bdab6836..bf995aa83 100644 +--- a/datapath/linux/compat/geneve.c ++++ b/datapath/linux/compat/geneve.c +@@ -962,7 +962,16 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, + return dst; + } + +-#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) ++#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW) ++#ifdef HAVE_IPV6_DST_LOOKUP_FLOW_NET ++ dst = ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, fl6, ++ NULL); ++#else ++ dst = ipv6_stub->ipv6_dst_lookup_flow(gs6->sock->sk, fl6, ++ NULL); ++#endif ++ if (IS_ERR(dst)) { ++#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) + if (ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, &dst, + fl6)) { + #elif defined(HAVE_IPV6_DST_LOOKUP_FLOW) +diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c +index ff10ae6f4..05ccfb928 100644 +--- a/datapath/linux/compat/vxlan.c ++++ b/datapath/linux/compat/vxlan.c +@@ -967,7 +967,10 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + bool use_cache = (dst_cache && ip_tunnel_dst_cache_usable(skb, info)); + struct dst_entry *ndst; + struct flowi6 fl6; ++#if !defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) || \ ++ !defined(HAVE_IPV6_DST_LOOKUP_FLOW) + int err; ++#endif + + if (!sock6) + return ERR_PTR(-EIO); +@@ -990,7 +993,15 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + fl6.fl6_dport = dport; + fl6.fl6_sport = sport; + +-#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) ++#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW) ++#ifdef HAVE_IPV6_DST_LOOKUP_FLOW_NET ++ ndst = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk, ++ &fl6, NULL); ++#else ++ ndst = ipv6_stub->ipv6_dst_lookup_flow(sock6->sock->sk, &fl6, NULL); ++#endif ++ if (unlikely(IS_ERR(ndst))) { ++#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET) + err = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk, + &ndst, &fl6); + #elif defined(HAVE_IPV6_DST_LOOKUP_FLOW) +@@ -1004,8 +1015,13 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + #else + err = ip6_dst_lookup(vxlan->vn6_sock->sock->sk, &ndst, &fl6); + #endif ++#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW) ++ return ERR_PTR(-ENETUNREACH); ++ } ++#else + if (err < 0) + return ERR_PTR(err); ++#endif + + *saddr = fl6.saddr; + if (use_cache) -- 2.30.2