Browse Source

openvswitch: upgrade to 2.8.1 ; package more stuff from the OVS build

I should have packaged the OVN stuff, VTEP and what-not
earlier, but was not inspired to do this earlier.

I made some time now to package those parts.

Disabling flake8 & python3 explicitly.
They might get detected and cause weird build errors.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
lilik-openwrt-22.03
Alexandru Ardelean 7 years ago
parent
commit
1a53301cd1
4 changed files with 157 additions and 63 deletions
  1. +115
    -21
      net/openvswitch/Makefile
  2. +12
    -31
      net/openvswitch/files/etc/init.d/openvswitch.init
  3. +30
    -0
      net/openvswitch/patches/0006-adapt-ovs-scripts.patch
  4. +0
    -11
      net/openvswitch/patches/0009-fix-test-ovn.patch

+ 115
- 21
net/openvswitch/Makefile View File

@ -1,6 +1,6 @@
#
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014 OpenWrt.org
# Copyright (C) 2014-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -13,14 +13,14 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openvswitch
PKG_RELEASE:=1
PKG_VERSION:=2.7.2
PKG_VERSION:=2.8.1
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=COPYING
PKG_USE_MIPS16:=0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://openvswitch.org/releases/
PKG_HASH:=fe36c86ed52f6f7c17b01cdbb7ae37bf521cc5c2e50997b618f3f742485f655b
PKG_HASH:=8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
PKG_BUILD_DEPENDS:=python/host python-six/host
PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_openvswitch-python
@ -64,6 +64,43 @@ define Package/openvswitch-base/description
to conserve some room and allow more configurability.
endef
define Package/openvswitch-ovn-base
$(call Package/openvswitch/Default)
TITLE:=Open Virtual Networking (base)
DEPENDS:=+openvswitch-base
endef
define Package/openvswitch-ovn-base/description
Provides the main userspace components required for Open Virtual Networking
over Open vSwitch.
endef
OVN_BIN_TOOLS:=ovn-controller ovn-controller-vtep ovn-detrace \
ovn-docker-overlay-driver ovn-docker-underlay-driver \
ovn-nbctl ovn-sbctl ovn-trace
define Package/openvswitch-ovn
$(call Package/openvswitch/Default)
TITLE:=Open Virtual Networking (base)
DEPENDS:=+openvswitch-ovn-base $(foreach t,$(OVN_BIN_TOOLS),+openvswitch-$(t))
endef
define Package/openvswitch-ovn/description
Provides all the components required for Open Virtual Networking
(including the tools)
endef
define Package/openvswitch-vtep
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch VXLAN Tunnel End Point
DEPENDS:=+openvswitch-base
endef
define Package/openvswitch-vtep/description
This schema specifies relations that a VTEP can use to integrate physi‐
cal ports into logical switches maintained by a network virtualization
controller such as NSX.
endef
define Package/openvswitch-python
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Python Support
@ -74,7 +111,9 @@ define Package/openvswitch-python/description
Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
endef
OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
OVS_BIN_TOOLS:= \
ovsdb-client ovs-l3ping ovs-dpctl-top \
ovs-tcpdump ovs-tcpundump ovs-pcap ovs-parse-backtrace
define Package/openvswitch
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
@ -83,7 +122,7 @@ endef
define Package/openvswitch/description
Provides the main userspace components required for Open vSwitch to function.
Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
Includes also most of OVS utilities.
endef
define KernelPackage/openvswitch
@ -117,26 +156,30 @@ CONFIGURE_ARGS += --enable-shared
TARGET_CFLAGS += -flto -std=gnu99
CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
CONFIGURE_VARS += \
ovs_cv_flake8=no \
ovs_cv_python3=no \
KARCH=$(LINUX_KARCH)
MAKE_FLAGS += \
ARCH="$(LINUX_KARCH)" \
PYTHONPATH="$(HOST_PYTHONPATH)" \
PYTHON="$(HOST_PYTHON_BIN)"
define OvsBinUtility
define Package/openvswitch-$(1)
define Package/openvswitch-$(2)
$(call Package/openvswitch/Default)
TITLE:=$(2)
DEPENDS:=+openvswitch-base
TITLE:=$(3)
DEPENDS:=+$(1) $(4)
endef
define Package/openvswitch-$(1)/description
$(2)
define Package/openvswitch-$(2)/description
$(3)
endef
define Package/openvswitch-$(1)/install
define Package/openvswitch-$(2)/install
$(INSTALL_DIR) $$(1)/usr/bin/ ;\
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
endef
endef
@ -153,14 +196,40 @@ define Package/openvswitch-base/install
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
$(foreach bin,ovsdb-tool ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovs-pki, \
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(bin) $(1)/usr/bin/ ; )
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/share/openvswitch/
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
$(INSTALL_DIR) $(1)/usr/share/openvswitch/scripts
$(INSTALL_CONF) \
$(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema \
$(1)/usr/share/openvswitch/
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-lib \
$(1)/usr/share/openvswitch/scripts
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-ctl \
$(1)/usr/share/openvswitch/scripts
endef
define Package/openvswitch-ovn-base/install
$(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libovn*.so* $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovn-northd $(1)/usr/bin/
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-nb.ovsschema $(1)/usr/share/openvswitch/
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-sb.ovsschema $(1)/usr/share/openvswitch/
endef
define Package/openvswitch-vtep/install
$(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtep-ctl $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libvtep*.so* $(1)/usr/lib/
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vtep.ovsschema $(1)/usr/share/openvswitch/
endef
define Package/openvswitch-python/install
@ -168,19 +237,44 @@ define Package/openvswitch-python/install
$(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
endef
define Package/openvswitch-ovn/install
:
endef
define Package/openvswitch/install
:
endef
$(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
$(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
$(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
$(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
$(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-appctl,Open vSwitch app control utility))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-ofctl,Open vSwitch OpenFlow control utility))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl,Open vSwitch datapath management utility))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
$(eval $(call OvsBinUtility,openvswitch-base,ovsdb-client,Open vSwitch database JSON-RPC client))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-l3ping,Check network deployment for L3 tunneling problems))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-docker,Open vSwitch docker tool))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl-top,Top like behavior for ovs-dpctl dump-flows))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-pki,OpenFlow public key infrastructure management utility))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpdump,Dump traffic from an Open vSwitch port using tcpdump))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpundump,Convert ``tcpdump -xx`` output to hex strings))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-pcap,Print packets from a pcap file as hex))
$(eval $(call OvsBinUtility,openvswitch-base,ovs-parse-backtrace,parses ovs-appctl backtrace output))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller,Open Virtual Network local controller))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller-vtep,Open Virtual Network local controller for vtep enabled physical switches,+openvswitch-vtep))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-detrace,Convert ``ovs-appctl ofproto/trace`` output to combine OVN logical flow information))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-overlay-driver,OVN Docker overlay driver utility))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-underlay-driver,OVN Docker underlay driver utility))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-nbctl,Open Virtual Network northbound db management utility))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-sbctl,Utility for querying and configuring OVN_Southbound database))
$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-trace,Open Virtual Network logical network tracing utility))
$(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
$(foreach t,$(OVN_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
$(eval $(call BuildPackage,openvswitch-base))
$(eval $(call BuildPackage,openvswitch-ovn-base))
$(eval $(call BuildPackage,openvswitch-ovn))
$(eval $(call BuildPackage,openvswitch-vtep))
$(eval $(call BuildPackage,openvswitch-python))
$(eval $(call BuildPackage,openvswitch))
$(eval $(call KernelPackage,openvswitch))


+ 12
- 31
net/openvswitch/files/etc/init.d/openvswitch.init View File

@ -1,41 +1,22 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014 OpenWrt.org
# Copyright (C) 2014-2017 OpenWrt.org
START=15
USE_PROCD=1
start_service() {
[ -x /var/run/openvswitch ] || mkdir -p /var/run/openvswitch
[ -e /etc/openvswitch/conf.db ] || {
/usr/bin/ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
}
start() {
/usr/share/openvswitch/scripts/ovs-ctl start
}
# ovsdb-server
procd_open_instance
procd_set_param command /usr/sbin/ovsdb-server
procd_append_param command --remote=punix:/var/run/db.sock
procd_append_param command --remote=db:Open_vSwitch,Open_vSwitch,manager_options
procd_append_param command --pidfile=/var/run/ovsdb-server.pid
procd_set_param respawn
procd_append_param respawn 3600
procd_append_param respawn 5
procd_append_param respawn -1
procd_set_param nice
procd_append_param nice -10
procd_close_instance
stop() {
/usr/share/openvswitch/scripts/ovs-ctl stop
}
# ovs-vswitchd
procd_open_instance
procd_set_param command /usr/sbin/ovs-vswitchd
procd_append_param command --pidfile=/var/run/ovs-vswitchd.pid
procd_set_param respawn
procd_append_param respawn 3600
procd_append_param respawn 5
procd_append_param respawn -1
procd_set_param nice
procd_append_param nice -10
procd_close_instance
restart() {
/usr/share/openvswitch/scripts/ovs-ctl restart
}
status() {
/usr/share/openvswitch/scripts/ovs-ctl status
}

+ 30
- 0
net/openvswitch/patches/0006-adapt-ovs-scripts.patch View File

@ -0,0 +1,30 @@
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index dc1d02c..61ecf2f 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -108,7 +108,7 @@ set_system_ids () {
esac
set "$@" external-ids:system-id="\"$SYSTEM_ID\""
- set "$@" external-ids:hostname="\"$(hostname -f)\""
+ set "$@" external-ids:hostname="\"$(cat /proc/sys/kernel/hostname)\""
set "$@" external-ids:rundir="\"$rundir\""
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 8665698..7931bc6 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -157,7 +157,11 @@ install_dir () {
[ "${OVS_USER##*:}" != "" ] && INSTALL_GROUP="${OVS_USER##*:}"
if test ! -d "$DIR"; then
- install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
+ mkdir -p "$DIR"
+ [ -n "$INSTALL_MODE" ] && chmod "$INSTALL_MODE" "$DIR"
+ local OWN="$INSTALL_USER"
+ [ -n "$OWN" ] && [ -n "$INSTALL_GROUP" ] && OWN="${OWN}:${INSTALL_GROUP}"
+ [ -n "$OWN" ] && chown "$OWN" "$DIR"
restorecon "$DIR" >/dev/null 2>&1
fi
}

+ 0
- 11
net/openvswitch/patches/0009-fix-test-ovn.patch View File

@ -1,11 +0,0 @@
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -1043,7 +1043,7 @@ wait_pid(pid_t *pids, int *n)
int status;
pid_t pid;
- pid = waitpid(WAIT_ANY, &status, 0);
+ pid = waitpid(-1, &status, 0);
if (pid < 0) {
ovs_fatal(errno, "waitpid failed");
} else if (WIFEXITED(status)) {

Loading…
Cancel
Save