openvswitch: backport patch to fix compilation

This commit is contained in:
LEAN-ESX 2019-12-07 05:32:25 -08:00
parent 52769aef9e
commit d75bcfcfb8
7 changed files with 84 additions and 69 deletions

View File

@ -15,11 +15,11 @@ include $(INCLUDE_DIR)/kernel.mk
# - Check and update kmod dependencies when necessary (runtime module load check in the least)
#
PKG_NAME:=openvswitch
PKG_VERSION:=2.11.0
PKG_RELEASE:=3
PKG_VERSION:=2.12.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
PKG_HASH:=f4b01d7376d7298bc6e7fa7a6067229ca7c7e299394e5ea9aff651d52edfdbee
PKG_HASH:=13fd42703180b4b1146c7e97926d09225485868cc2fbbd58dc0c421b4b8fe8f8
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
@ -41,7 +41,7 @@ include ../../lang/python/python3-package.mk
ovs_kmod_packages:=
ovs_kmod_intree_kernel_patchver_min:=3.10
ovs_kmod_intree_kernel_patchver_max:=4.18
ovs_kmod_intree_kernel_patchver_max:=5.0
ovs_kmod_intree_not_supported:=$(strip $(call kernel_patchver_lt,$(ovs_kmod_intree_kernel_patchver_min))$(call kernel_patchver_gt,$(ovs_kmod_intree_kernel_patchver_max)))
ovs_kmod_intree_dir:=$(PKG_BUILD_DIR)/datapath/linux
ovs_kmod_upstream_dir:=$(LINUX_DIR)/net/openvswitch
@ -50,12 +50,13 @@ ovs_kmod_is_intree=$(filter %-intree,$(1))
ovs_kmod_upstream_name=kmod-$(call ovs_kmod_package_name,$(patsubst %-intree,%,$(1)))
ovs_kmod_package_provides=$(call ovs_kmod_upstream_name,$(1))
define OvsKmodPackageTemplate
ifeq ($(if $(call ovs_kmod_is_intree,$(1)),$(ovs_kmod_intree_not_supported)),)
define KernelPackage/$(call ovs_kmod_package_name,$(1))
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
TITLE:=$(ovs_kmod_$(1)_title)
DEPENDS:=$(ovs_kmod_$(1)_depends) $(if $(call ovs_kmod_is_intree,$(1)),@DEVEL $(if $(ovs_kmod_intree_not_supported),@BROKEN))
DEPENDS:=$(ovs_kmod_$(1)_depends) $(if $(call ovs_kmod_is_intree,$(1)),@DEVEL)
PROVIDES:=$(call ovs_kmod_package_provides,$(1))
KCONFIG:=$(ovs_kmod_$(1)_kconfig)
FILES:=$(ovs_kmod_$(1)_files)
@ -63,14 +64,20 @@ define OvsKmodPackageTemplate
endef
ovs_kmod_packages+=$(call ovs_kmod_package_name,$(1))
endif
endef
ovs_kmod_openvswitch_title:=Open vSwitch kernel datapath (upstream)
ovs_kmod_openvswitch_kconfig:=CONFIG_OPENVSWITCH
ovs_kmod_openvswitch_depends:=\
+kmod-lib-crc32c +kmod-mpls \
+kmod-nf-nat +IPV6:kmod-nf-nat6 \
+kmod-nf-conntrack +IPV6:kmod-nf-conntrack6
+kmod-lib-crc32c \
+kmod-nf-nat \
+IPV6:kmod-nf-nat6 \
+kmod-nf-conntrack \
+IPV6:kmod-nf-conntrack6 \
+(!LINUX_4_9&&!LINUX_4_14):kmod-nsh \
+(!LINUX_4_9&&!LINUX_4_14):kmod-ipt-conntrack-extra \
ovs_kmod_openvswitch_files:=$(ovs_kmod_upstream_dir)/openvswitch.ko
$(eval $(call OvsKmodPackageTemplate,openvswitch))
@ -105,8 +112,20 @@ $(eval $(call OvsKmodPackageTemplate,openvswitch-geneve))
# will be pulled in by kmod-gre6. NOTE that tunnel6.ko itself cannot be
# enabled and selected on its own
#
# - kmod-ipt-conntrack-extra: required for nf_conncount.ko
#
ovs_kmod_openvswitch-intree_title:=Open vSwitch kernel datapath (in tree)
ovs_kmod_openvswitch-intree_depends:=$(ovs_kmod_openvswitch_depends) +kmod-gre +IPV6:kmod-gre6
ovs_kmod_openvswitch-intree_depends:=\
+kmod-lib-crc32c \
+kmod-nf-nat \
+IPV6:kmod-nf-nat6 \
+kmod-nf-conntrack \
+(IPV6&&(LINUX_4_9||LINUX_4_14)):kmod-nf-conntrack6 \
+(LINUX_4_9||LINUX_4_14):kmod-gre \
+(IPV6&&(LINUX_4_9||LINUX_4_14)):kmod-gre6 \
+(!LINUX_4_9&&!LINUX_4_14):kmod-udptunnel4 \
+(!LINUX_4_9&&!LINUX_4_14):kmod-ipt-conntrack-extra \
ovs_kmod_openvswitch-intree_files:= $(ovs_kmod_intree_dir)/openvswitch.ko
$(eval $(call OvsKmodPackageTemplate,openvswitch-intree))
@ -312,7 +331,11 @@ ovs_intree_kmod_configs:=CONFIG_PACKAGE_kmod-openvswitch-intree
ovs_intree_kmod_enabled:=$(strip $(foreach c,$(ovs_intree_kmod_configs),$($(c))))
PKG_CONFIG_DEPENDS+=$(ovs_intree_kmod_configs)
ifneq ($(ovs_intree_kmod_enabled),)
CONFIGURE_ARGS += --with-linux=$(LINUX_DIR)
ifeq ($(ovs_kmod_intree_not_supported),)
CONFIGURE_ARGS += --with-linux=$(LINUX_DIR)
else
$(warning XXX: openvswitch: intree kmods selected but not supported)
endif
endif
TARGET_CFLAGS += -flto -std=gnu99

View File

@ -1,7 +1,7 @@
From bfcee43923a4bb07954f6648bde1abdcbfa5d95f Mon Sep 17 00:00:00 2001
From d215c18a17e82194d4ab9ecd14776712f12d6b07 Mon Sep 17 00:00:00 2001
From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Wed, 8 Jan 2014 13:48:49 +0100
Subject: [PATCH 1/5] netdev-linux: Let interface flag survive internal port
Subject: [PATCH 1/4] netdev-linux: Let interface flag survive internal port
setup
Due to a race condition when bringing up an internal port on Linux
@ -18,10 +18,10 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 25d037cb6..ba1427986 100644
index 2432cd176..11efbdbc9 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -3117,7 +3117,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
@@ -3161,7 +3161,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
unsigned int old_flags, new_flags;
int error = 0;

View File

@ -1,7 +1,7 @@
From e881c50ff537d4b34c10227360589f83d90ce373 Mon Sep 17 00:00:00 2001
From e2d9b5d6fc33d7b9cbb7dc16832c5c86e6470966 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <zhouyousong@yunionyun.com>
Date: Tue, 21 Aug 2018 12:21:05 +0000
Subject: [PATCH 2/5] python: separate host/target python for cross-compile
Subject: [PATCH 2/4] python: separate host/target python for cross-compile
At the moment, python-six is a requirement for openvswitch python
library on target machine.
@ -26,10 +26,10 @@ index ff1f94b48..417f53230 100644
ALL_LOCAL =
BUILT_SOURCES =
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 41042c98e..4a5f0a84a 100644
index cd6b51d86..6dc9d630b 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -449,7 +449,9 @@ AC_DEFUN([OVS_CHECK_PYTHON],
@@ -456,7 +456,9 @@ AC_DEFUN([OVS_CHECK_PYTHON],
fi])
AC_SUBST([PYTHON])
PYTHON=$ovs_cv_python

View File

@ -1,7 +1,7 @@
From b65652ff441c4236b51f037a76147331c1ffd5fd Mon Sep 17 00:00:00 2001
From 10fa6a820c155b6b7a97875de0b805aacf1046b8 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Wed, 14 Mar 2018 16:44:13 +0800
Subject: [PATCH 3/5] ovs-lib: fix install_dir()
Subject: [PATCH 3/4] ovs-lib: fix install_dir()
The command "install" is not available in OpenWrt by default
@ -11,7 +11,7 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 9a0af2e82..68ab3f250 100644
index d646b444a..dee63dece 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -159,7 +159,10 @@ install_dir () {

View File

@ -1,7 +1,7 @@
From 2f9075aca5f54b8d0c14517c408f162985fb1b18 Mon Sep 17 00:00:00 2001
From 77dfef9dd14987b091c2d4fc9475690759e1f4d7 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <zhouyousong@yunionyun.com>
Date: Tue, 21 Aug 2018 13:02:21 +0000
Subject: [PATCH 4/5] build: disable building tests
Subject: [PATCH 4/4] build: disable building tests
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
---

View File

@ -1,46 +0,0 @@
From b89f391203c4420eb454cb321e799a64de809f52 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <zhouyousong@yunionyun.com>
Date: Fri, 3 May 2019 15:03:24 +0000
Subject: [PATCH 5/5] datapath: conntrack: fix include for
IP6_DEFRAG_CONNTRACK_IN
The enum definition is now inside include/net/ipv6_frag.h since upstream commit
70b095c ("ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module") which was
backported to stable trees (4.9, 4.14, 4.19) only these days.
The error message
CC [M] /opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.o
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c: In function 'handle_fragments':
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c:554:8: error: variable 'user' has initializer but incomplete type
enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
^~~~~~~~~~~~~~~~
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c:554:32: error: 'IP6_DEFRAG_CONNTRACK_IN' undeclared (first use in this function); did you mean 'IP_DEFRAG_CONNTRACK_IN'?
enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
^~~~~~~~~~~~~~~~~~~~~~~
IP_DEFRAG_CONNTRACK_IN
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c:554:32: note: each undeclared identifier is reported only once for each function it appears in
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c:554:25: error: storage size of 'user' isn't known
enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
^~~~
/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.c:554:25: warning: unused variable 'user' [-Wunused-variable]
scripts/Makefile.build:326: recipe for target '/opt/buildbot/slaves/lede-slave-tah/mipsel_24kc/build/sdk/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/openvswitch-2.11.0/datapath/linux/conntrack.o' failed
Reference: https://github.com/openwrt/packages/issues/8548#issuecomment-488871090
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
---
datapath/conntrack.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index a7dc9e0c3..69bda5a9c 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>

View File

@ -0,0 +1,38 @@
From d84109f0b60096ce71cd0537b31b69a7f5ea8756 Mon Sep 17 00:00:00 2001
From: Flavio Leitner <fbl@sysclose.org>
Date: Sat, 14 Sep 2019 20:17:28 -0300
Subject: [PATCH] ovsdb-idlc.in: fix dict change during iteration.
Python3 complains if a dict key is changed during the
iteration.
Use list() to create a copy of it.
Traceback (most recent call last):
File "./ovsdb/ovsdb-idlc.in", line 1581, in <module>
func(*args[1:])
File "./ovsdb/ovsdb-idlc.in", line 185, in printCIDLHeader
replace_cplusplus_keyword(schema)
File "./ovsdb/ovsdb-idlc.in", line 179, in replace_cplusplus_keyword
for columnName in table.columns:
RuntimeError: dictionary keys changed during iteration
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
ovsdb/ovsdb-idlc.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 40fef39edf..22d0a4e22e 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -176,7 +176,7 @@ def replace_cplusplus_keyword(schema):
'wchar_t', 'while', 'xor', 'xor_eq'}
for tableName, table in schema.tables.items():
- for columnName in table.columns:
+ for columnName in list(table.columns):
if columnName in keywords:
table.columns[columnName + '_'] = table.columns.pop(columnName)