aboutsummaryrefslogtreecommitdiff
path: root/net/openvswitch
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/Makefile353
-rw-r--r--net/openvswitch/README.md39
-rw-r--r--net/openvswitch/files/etc/init.d/openvswitch.init22
-rw-r--r--net/openvswitch/files/openvswitch.config8
-rwxr-xr-xnet/openvswitch/files/openvswitch.init68
-rwxr-xr-xnet/openvswitch/files/ovs-ctl-wrapper8
-rw-r--r--net/openvswitch/patches/0001-musl-compatibility.patch16
-rw-r--r--net/openvswitch/patches/0100-netdev-linux-Use-unsigned-int-for-ifi_flags.patch7
-rw-r--r--net/openvswitch/patches/0101-netdev-linux-Let-interface-flag-survive-internal-por.patch7
-rw-r--r--net/openvswitch/patches/0102-python-separate-host-target-python-for-cross-compile.patch11
-rw-r--r--net/openvswitch/patches/0103-ovs-ctl-fix-setting-hostname.patch7
-rw-r--r--net/openvswitch/patches/0104-ovs-lib-fix-install_dir.patch9
12 files changed, 288 insertions, 267 deletions
diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile
index eb540472e..54b436a26 100644
--- a/net/openvswitch/Makefile
+++ b/net/openvswitch/Makefile
@@ -1,29 +1,26 @@
#
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014-2017 OpenWrt.org
+# Copyright (C) 2018 Yousong Zhou <yszhou4tech@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
-# $Id: Makefile $
-
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openvswitch
-
PKG_VERSION:=2.8.2
-PKG_RELEASE:=1
-PKG_LICENSE:=Apache-2.0
-PKG_LICENSE_FILES:=COPYING
-PKG_USE_MIPS16:=0
-
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
PKG_HASH:=87b4a7e7134a44ce1f808d3415a2244b4518c2b0b2a42fa2f8231e592f13103d
-PKG_BUILD_DEPENDS:=python/host python-six/host
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=LICENSE
+PKG_BUILD_DEPENDS:=python/host python-six/host
+PKG_USE_MIPS16:=0
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
@@ -34,94 +31,22 @@ include $(INCLUDE_DIR)/package.mk
include ../../lang/python/python-host.mk
include ../../lang/python/python-package.mk
-define Package/openvswitch/Default
- SECTION:=net
- SUBMENU:=Open vSwitch
- CATEGORY:=Network
- URL:=http://openvswitch.org/
-endef
-
-define Package/openvswitch/Default/description
- Open vSwitch is a production quality, multilayer, software-based, Ethernet
- virtual switch. It is designed to enable massive network automation through
- programmatic extension, while still supporting standard management interfaces
- and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
- addition, it is designed to support distribution across multiple physical
- servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
- 1000V.
-endef
-
-define Package/openvswitch-base
- $(call Package/openvswitch/Default)
- TITLE:=Open vSwitch Userspace Package (base)
- DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch
-endef
-
-define Package/openvswitch-base/description
- Provides the main userspace components required for Open vSwitch to function.
- The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
- 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
+CONFIGURE_ARGS+= \
+ --enable-ndebug \
+ --enable-shared \
+ --disable-libcapng \
-OVN_BIN_TOOLS:=ovn-controller ovn-controller-vtep ovn-detrace \
- 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
- DEPENDS:=+PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
-endef
-
-define Package/openvswitch-python/description
- Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
-endef
+CONFIGURE_VARS += \
+ ovs_cv_flake8=no \
+ ovs_cv_python3=no \
+ ovs_cv_sphinx=no \
+ ovs_cv_python=$(PYTHON) \
+ ovs_cv_python_host=$(HOST_PYTHON_BIN) \
-OVS_BIN_TOOLS:= \
- ovsdb-client ovs-l3ping ovs-dpctl-top \
- ovs-tcpdump ovs-tcpundump ovs-pcap
-define Package/openvswitch
- $(call Package/openvswitch/Default)
- TITLE:=Open vSwitch Userspace Package
- DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
-endef
+TARGET_CFLAGS += -flto -std=gnu99
+MAKE_VARS += PYTHONPATH="$(HOST_PYTHONPATH)"
-define Package/openvswitch/description
- Provides the main userspace components required for Open vSwitch to function.
- Includes also most of OVS utilities.
-endef
define KernelPackage/openvswitch
SECTION:=kernel
@@ -169,129 +94,157 @@ define KernelPackage/openvswitch-geneve
AUTOLOAD:=$(call AutoProbe,vport-geneve)
endef
-CONFIGURE_ARGS += --enable-ndebug
-CONFIGURE_ARGS += --enable-shared
-
-TARGET_CFLAGS += -flto -std=gnu99
-
-CONFIGURE_VARS += \
- ovs_cv_flake8=no \
- ovs_cv_python3=no \
- ovs_cv_sphinx=no \
- ovs_cv_python=$(PYTHON) \
- ovs_cv_python_host=$(HOST_PYTHON_BIN) \
- KARCH=$(LINUX_KARCH)
-
-MAKE_VARS += PYTHONPATH="$(HOST_PYTHONPATH)"
-MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
-define OvsBinUtility
- define Package/openvswitch-$(2)
- $(call Package/openvswitch/Default)
- TITLE:=$(3)
- DEPENDS:=+$(1) $(4)
+ovs_packages:=
+ovs_package_name=$(if $(filter openvswitch,$(1)),openvswitch,openvswitch-$(1))
+define OvsPackageTemplate
+ define Package/$(call ovs_package_name,$(1))
+ SECTION:=net
+ SUBMENU:=Open vSwitch
+ CATEGORY:=Network
+ URL:=https://www.openvswitch.org
+ TITLE:=$(ovs_$(1)_title)
+ HIDDEN:=$(ovs_$(1)_hidden)
+ DEPENDS:=$(ovs_$(1)_depends)
endef
- define Package/openvswitch-$(2)/description
- $(3)
+ define Package/$(call ovs_package_name,$(1))/install
+ $(foreach f,$(ovs_$(1)_files),
+ $(INSTALL_DIR) $$(1)/$(dir $(f))
+ $(CP) $(PKG_INSTALL_DIR)/$(f) $$(1)/$(dir $(f))
+ )
+ $(ovs_$(1)_install)
endef
- define Package/openvswitch-$(2)/install
- $(INSTALL_DIR) $$(1)/usr/bin/ ;\
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
- endef
+ ovs_packages+=$(call ovs_package_name,$(1))
endef
-define Package/openvswitch-base/install
- $(INSTALL_DIR) $(1)/etc/openvswitch
-
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
-
- $(INSTALL_DIR) $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
-
- $(INSTALL_DIR) $(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/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
+# Dependency review
+#
+# for f in sbin/*; do echo $f; readelf -d $f | grep -i shared; done
+# for f in bin/*; do echo $f; readelf -d $f | grep -i shared; done
+# for f in lib/*.so; do echo $f; readelf -d $f | grep -i shared; done
+#
+ovs_libopenvswitch_title:=Open vSwitch (libopenvswitch.so)
+ovs_libopenvswitch_hidden:=1
+ovs_libopenvswitch_depends:=+libopenssl +librt
+ovs_libopenvswitch_files:=usr/lib/libopenvswitch*.so*
+$(eval $(call OvsPackageTemplate,libopenvswitch))
-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/
+ovs_libofproto_title:=Open vSwitch (libofproto.so libsflow.so)
+ovs_libofproto_hidden:=1
+ovs_libofproto_depends:=+librt
+ovs_libofproto_files:=usr/lib/libofproto*.so* usr/lib/libsflow*.so*
+$(eval $(call OvsPackageTemplate,libofproto))
- $(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
+ovs_libovsdb_title:=Open vSwitch (libovsdb.so)
+ovs_libovsdb_hidden:=1
+ovs_libovsdb_depends:=+librt
+ovs_libovsdb_files:=usr/lib/libovsdb*.so*
+$(eval $(call OvsPackageTemplate,libovsdb))
-define Package/openvswitch-python/install
- $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
- $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
-endef
-define Package/openvswitch-ovn/install
- :
-endef
+ovs_libovn_title:=Open vSwitch (libovn.so)
+ovs_libovn_hidden:=1
+ovs_libovn_depends:=+librt
+ovs_libovn_files:=usr/lib/libovn*.so*
+$(eval $(call OvsPackageTemplate,libovn))
-define Package/openvswitch/install
- :
+
+ovs_vswitchd_title:=Open vSwitch (ovs-vswitchd)
+ovs_vswitchd_hidden:=1
+ovs_vswitchd_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libofproto
+ovs_vswitchd_files:=usr/sbin/ovs-vswitchd
+$(eval $(call OvsPackageTemplate,vswitchd))
+
+
+ovs_ovsdb_title:=Open vSwitch (ovsdb-server)
+ovs_ovsdb_hidden:=1
+ovs_ovsdb_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libovsdb
+ovs_ovsdb_files:=usr/sbin/ovsdb-server
+$(eval $(call OvsPackageTemplate,ovsdb))
+
+
+ovs_common_title:=Open vSwitch (common files)
+ovs_common_hidden:=1
+ovs_common_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libofproto +openvswitch-libovsdb
+ovs_common_files:= \
+ usr/share/openvswitch/scripts/ovs-lib \
+ usr/share/openvswitch/scripts/ovs-ctl \
+ usr/share/openvswitch/scripts/ovs-save \
+ $(foreach b,ovs-appctl ovs-dpctl ovs-ofctl ovs-vsctl ovsdb-client ovsdb-tool,usr/bin/$(b))
+define ovs_common_install
+ $$(INSTALL_DIR) $$(1)/etc/openvswitch
+ $$(INSTALL_DIR) $$(1)/etc/init.d
+ $$(INSTALL_BIN) ./files/openvswitch.init $$(1)/etc/init.d/openvswitch
+ $$(INSTALL_DIR) $$(1)/etc/config
+ $$(INSTALL_DATA) ./files/openvswitch.config $$(1)/etc/config/openvswitch
+ $$(INSTALL_DIR) $$(1)/usr/share/openvswitch/scripts
+ $$(INSTALL_BIN) ./files/ovs-ctl-wrapper $$(1)/usr/share/openvswitch/scripts/
+ $$(LN) /usr/share/openvswitch/scripts/ovs-ctl-wrapper $$(1)/usr/bin/ovs-ctl
+endef
+define Package/openvswitch-common/conffiles
+/etc/openvswitch
endef
+$(eval $(call OvsPackageTemplate,common))
-$(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-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-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-nbctl,Open Virtual Network northbound db management utility))
-$(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-sbctl,Utility for querying and configuring OVN_Southbound data‐base))
-$(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))
+
+# coreutils-sleep is required by ovs-lib for sleeping a fraction of second
+#
+# uuidgen is required for generating system-id
+ovs_openvswitch_title:=Open vSwitch
+ovs_openvswitch_hidden:=
+ovs_openvswitch_depends:=+librt +coreutils +coreutils-sleep +uuidgen \
+ +openvswitch-common +openvswitch-vswitchd +openvswitch-ovsdb +kmod-openvswitch
+ovs_openvswitch_files:= usr/share/openvswitch/vswitch.ovsschema
+$(eval $(call OvsPackageTemplate,openvswitch))
+
+
+ovs_ovn-common_title:=Open Virtual Network (common files)
+ovs_ovn-common_hidden:=1
+ovs_ovn-common_depends:=+librt +openvswitch-common +openvswitch-libopenvswitch +openvswitch-libovn +openvswitch-libovsdb
+ovs_ovn-common_files:= \
+ usr/share/openvswitch/scripts/ovn-ctl \
+ $(foreach b,ovn-nbctl ovn-sbctl ovn-trace ovn-detrace,usr/bin/$(b))
+define ovs_ovn-common_install
+ $$(INSTALL_DIR) $$(1)/usr/share/openvswitch/scripts
+ $$(LN) /usr/share/openvswitch/scripts/ovs-ctl-wrapper $$(1)/usr/bin/ovn-ctl
+endef
+$(eval $(call OvsPackageTemplate,ovn-common))
+
+
+ovs_ovn-north_title:=Open Virtual Network (north package)
+ovs_ovn-north_hidden:=
+ovs_ovn-north_depends:=+openvswitch-ovsdb +openvswitch-ovn-common
+ovs_ovn-north_files:=\
+ usr/share/openvswitch/ovn-nb.ovsschema \
+ usr/share/openvswitch/ovn-sb.ovsschema \
+ usr/bin/ovn-northd
+$(eval $(call OvsPackageTemplate,ovn-north))
+
+
+ovs_ovn-host_title:=Open Virtual Network (chassis package)
+ovs_ovn-host_hidden:=
+ovs_ovn-host_depends:=+openvswitch +openvswitch-ovn-common
+ovs_ovn-host_files:=usr/bin/ovn-controller
+$(eval $(call OvsPackageTemplate,ovn-host))
+
+
+ovs_python_title:=Open vSwitch (Python library)
+ovs_python_hidden:=
+ovs_python_depends:=+PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
+define ovs_python_install
+ $$(INSTALL_DIR) $$(1)$$(PYTHON_PKG_DIR)
+ $$(CP) $$(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs $$(1)$$(PYTHON_PKG_DIR)
+endef
+$(eval $(call OvsPackageTemplate,python))
+
+
+$(foreach p,$(ovs_packages),\
+ $(eval $(call BuildPackage,$(p)))\
+)
$(eval $(call KernelPackage,openvswitch))
$(eval $(call KernelPackage,openvswitch-gre))
diff --git a/net/openvswitch/README.md b/net/openvswitch/README.md
new file mode 100644
index 000000000..290fce58a
--- /dev/null
+++ b/net/openvswitch/README.md
@@ -0,0 +1,39 @@
+# Which packages to install
+
+Install `openvswitch` if you need OpenFlow virtual switch function. It
+contains ovs-vswitchd, ovsdb-server and helper utilities such as ovs-vsctl,
+ovs-ofctl, ovs-ctl etc.
+
+Linux kernel datapath module openvswitch.ko will also be installed along with
+package `openvswitch`. Tunnel encap support for gre, geneve, vxlan can be
+included by installing `kmod-openvswitch-{gre,geneve,vxlan}` respectively
+
+For OVN deployment
+
+- Install `openvswitch-ovn-north` for ovs-northd, ovsdb-server, ovn helper utitlies
+- Install `openvswitch-ovn-host` for ovn-controller and `openvswitch`
+
+# How to use them
+
+Open vSwitch provides a few very useful helper script in
+`/usr/share/openvswitch/scripts/`. A simple initscript is provided. It's
+mainly a wrapper around `ovs-ctl` and `ovn-ctl` with simple knobs from
+`/etc/config/openvswitch`. Procd is not used here.
+
+ /etc/init.d/openvswitch start
+ /etc/init.d/openvswitch stop
+ /etc/init.d/openvswitch stop north
+ /etc/init.d/openvswitch restart ovs
+ /etc/init.d/openvswitch status
+
+Use `ovs-ctl` and `ovn-ctl` directly for more functionalities
+
+# TODO
+
+ovn
+
+ - controller init
+ - ls, lsp, lr, lrp
+ - qos
+ - nat
+ - ovsdb cluster
diff --git a/net/openvswitch/files/etc/init.d/openvswitch.init b/net/openvswitch/files/etc/init.d/openvswitch.init
deleted file mode 100644
index 84655e74c..000000000
--- a/net/openvswitch/files/etc/init.d/openvswitch.init
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
-# Copyright (C) 2014-2017 OpenWrt.org
-
-START=15
-
-start() {
- /usr/share/openvswitch/scripts/ovs-ctl start
-}
-
-stop() {
- /usr/share/openvswitch/scripts/ovs-ctl stop
-}
-
-restart() {
- /usr/share/openvswitch/scripts/ovs-ctl restart
-}
-
-status() {
- /usr/share/openvswitch/scripts/ovs-ctl status
-}
-
diff --git a/net/openvswitch/files/openvswitch.config b/net/openvswitch/files/openvswitch.config
new file mode 100644
index 000000000..1bd23775e
--- /dev/null
+++ b/net/openvswitch/files/openvswitch.config
@@ -0,0 +1,8 @@
+config ovs ovs
+ option disabled 1
+
+config ovn_northd north
+ option disabled 1
+
+config ovn_controller controller
+ option disabled 1
diff --git a/net/openvswitch/files/openvswitch.init b/net/openvswitch/files/openvswitch.init
new file mode 100755
index 000000000..3af1b1e40
--- /dev/null
+++ b/net/openvswitch/files/openvswitch.init
@@ -0,0 +1,68 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
+# Copyright (C) 2014-2017 OpenWrt.org
+# Copyright (C) 2018 Yousong Zhou <yszhou4tech@gmail.com>
+
+START=15
+
+ovs_script_dir=/usr/share/openvswitch/scripts
+ovs_ctl="$ovs_script_dir/ovs-ctl"
+ovn_ctl="$ovs_script_dir/ovn-ctl"
+
+EXTRA_COMMANDS=status
+
+start() {
+ ovs_action start "$@"
+}
+
+stop() {
+ ovs_action stop "$@"
+}
+
+restart() {
+ ovs_action restart "$@"
+}
+
+status() {
+ ovs_action status "$@"
+}
+
+ovs_action_cfgs=
+ovs_action() {
+ local action="$1"; shift
+ local cfgtype
+
+ ovs_action_cfgs="$*"
+ config_load openvswitch
+ for cfgtype in ovs ovn_northd ovn_controller; do
+ config_foreach "ovs_xx" "$cfgtype" "$action" "$cfgtype"
+ done
+}
+
+ovs_xx() {
+ local cfg="$1"
+ local action="$2"
+ local cfgtype="$3"
+ local disabled
+
+ if [ -n "$ovs_action_cfgs" ] && ! list_contains "ovs_action_cfgs" "$cfg"; then
+ return
+ fi
+ case "$action" in
+ status|stop) ;;
+ *)
+ config_get_bool disabled "$cfg" disabled 0
+ [ "$disabled" -le 0 ] || return
+ ;;
+ esac
+
+ case "$cfgtype" in
+ ovs)
+ "$ovs_ctl" "$action" \
+ --system-id=random
+ ;;
+ ovn_*)
+ "$ovn_ctl" "${action}_${cfgtype#ovn_}"
+ ;;
+ esac
+}
diff --git a/net/openvswitch/files/ovs-ctl-wrapper b/net/openvswitch/files/ovs-ctl-wrapper
new file mode 100755
index 000000000..20f344612
--- /dev/null
+++ b/net/openvswitch/files/ovs-ctl-wrapper
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+s=/usr/share/openvswitch/scripts
+case "$0" in
+ *ovs-ctl) "$s/ovs-ctl" "$@" ;;
+ *ovn-ctl) "$s/ovn-ctl" "$@" ;;
+ *) exit 1;;
+esac
diff --git a/net/openvswitch/patches/0001-musl-compatibility.patch b/net/openvswitch/patches/0001-musl-compatibility.patch
index ddcc5fc61..b648add30 100644
--- a/net/openvswitch/patches/0001-musl-compatibility.patch
+++ b/net/openvswitch/patches/0001-musl-compatibility.patch
@@ -1,20 +1,16 @@
-diff --git a/configure.ac b/configure.ac
-index e6a23a6..8a7c6d6 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -118,7 +118,6 @@ OVS_CHECK_XENSERVER_VERSION
+@@ -122,7 +122,6 @@ OVS_CHECK_SOCKET_LIBS
+ OVS_CHECK_XENSERVER_VERSION
OVS_CHECK_GROFF
- OVS_CHECK_GNU_MAKE
OVS_CHECK_TLS
-OVS_CHECK_ATOMIC_LIBS
OVS_CHECK_GCC4_ATOMICS
OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(1)
OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(2)
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index 712cb5a..e840f10 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
-@@ -40,7 +40,9 @@
+@@ -39,7 +39,9 @@
#include <netpacket/packet.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -22,13 +18,11 @@ index 712cb5a..e840f10 100644
#include <net/if_packet.h>
+#endif
#include <net/route.h>
- #include <netinet/in.h>
#include <poll.h>
-diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
-index 9ead907..0a131d7 100644
+ #include <stdlib.h>
--- a/lib/ovs-atomic.h
+++ b/lib/ovs-atomic.h
-@@ -318,7 +318,7 @@
+@@ -320,7 +320,7 @@
#include "util.h"
#define IN_OVS_ATOMIC_H
diff --git a/net/openvswitch/patches/0100-netdev-linux-Use-unsigned-int-for-ifi_flags.patch b/net/openvswitch/patches/0100-netdev-linux-Use-unsigned-int-for-ifi_flags.patch
index 290e44f7a..9dfcf6a8c 100644
--- a/net/openvswitch/patches/0100-netdev-linux-Use-unsigned-int-for-ifi_flags.patch
+++ b/net/openvswitch/patches/0100-netdev-linux-Use-unsigned-int-for-ifi_flags.patch
@@ -10,11 +10,9 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
lib/netdev-linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index c0471be15..0750e5f2c 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
-@@ -2788,7 +2788,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
+@@ -2810,7 +2810,7 @@ update_flags(struct netdev_linux *netdev
enum netdev_flags on, enum netdev_flags *old_flagsp)
OVS_REQUIRES(netdev->mutex)
{
@@ -23,6 +21,3 @@ index c0471be15..0750e5f2c 100644
int error = 0;
old_flags = netdev->ifi_flags;
---
-2.16.2
-
diff --git a/net/openvswitch/patches/0101-netdev-linux-Let-interface-flag-survive-internal-por.patch b/net/openvswitch/patches/0101-netdev-linux-Let-interface-flag-survive-internal-por.patch
index c8bbd31eb..a01758e20 100644
--- a/net/openvswitch/patches/0101-netdev-linux-Let-interface-flag-survive-internal-por.patch
+++ b/net/openvswitch/patches/0101-netdev-linux-Let-interface-flag-survive-internal-por.patch
@@ -17,11 +17,9 @@ Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
lib/netdev-linux.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index 0750e5f2c..59e7b9c96 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
-@@ -2791,7 +2791,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
+@@ -2813,7 +2813,13 @@ update_flags(struct netdev_linux *netdev
unsigned int old_flags, new_flags;
int error = 0;
@@ -36,6 +34,3 @@ index 0750e5f2c..59e7b9c96 100644
*old_flagsp = iff_to_nd_flags(old_flags);
new_flags = (old_flags & ~nd_to_iff_flags(off)) | nd_to_iff_flags(on);
if (new_flags != old_flags) {
---
-2.16.2
-
diff --git a/net/openvswitch/patches/0102-python-separate-host-target-python-for-cross-compile.patch b/net/openvswitch/patches/0102-python-separate-host-target-python-for-cross-compile.patch
index 4c4f623e4..568fd7bd2 100644
--- a/net/openvswitch/patches/0102-python-separate-host-target-python-for-cross-compile.patch
+++ b/net/openvswitch/patches/0102-python-separate-host-target-python-for-cross-compile.patch
@@ -12,11 +12,9 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
m4/openvswitch.m4 | 12 ++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
-diff --git a/Makefile.am b/Makefile.am
-index 31d633179..4b9e8d491 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -59,7 +59,7 @@ endif
+@@ -60,7 +60,7 @@ endif
# foo/__init__.pyc will cause Python to ignore foo.py.
run_python = \
PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
@@ -25,11 +23,9 @@ index 31d633179..4b9e8d491 100644
ALL_LOCAL =
BUILT_SOURCES =
-diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
-index 00ffad35f..52f207bda 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
-@@ -347,20 +347,16 @@ else:
+@@ -351,20 +351,16 @@ else:
if test $ovs_cv_python = no; then
AC_MSG_ERROR([cannot find python 2.7 or higher.])
fi
@@ -54,6 +50,3 @@ index 00ffad35f..52f207bda 100644
dnl Checks for Python 3.x, x >= 4.
AC_DEFUN([OVS_CHECK_PYTHON3],
---
-2.16.2
-
diff --git a/net/openvswitch/patches/0103-ovs-ctl-fix-setting-hostname.patch b/net/openvswitch/patches/0103-ovs-ctl-fix-setting-hostname.patch
index 473f211ba..258b3155c 100644
--- a/net/openvswitch/patches/0103-ovs-ctl-fix-setting-hostname.patch
+++ b/net/openvswitch/patches/0103-ovs-ctl-fix-setting-hostname.patch
@@ -13,11 +13,9 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
utilities/ovs-ctl.in | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
-diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
-index 4ddc450fb..52018e6d3 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
-@@ -68,9 +68,7 @@ ovs_vsctl () {
+@@ -64,9 +64,7 @@ insert_mod_if_required () {
}
set_hostname () {
@@ -28,6 +26,3 @@ index 4ddc450fb..52018e6d3 100755
}
set_system_ids () {
---
-2.16.2
-
diff --git a/net/openvswitch/patches/0104-ovs-lib-fix-install_dir.patch b/net/openvswitch/patches/0104-ovs-lib-fix-install_dir.patch
index f6f6747c7..ab2ecf541 100644
--- a/net/openvswitch/patches/0104-ovs-lib-fix-install_dir.patch
+++ b/net/openvswitch/patches/0104-ovs-lib-fix-install_dir.patch
@@ -1,4 +1,4 @@
-From d8dd661e1c100a2d2ba0361cf6c91dcdedfeeb70 Mon Sep 17 00:00:00 2001
+From 43b855e201bd25a015ba6444cabce12b8cc181ec Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Wed, 14 Mar 2018 16:44:13 +0800
Subject: [PATCH 104/104] ovs-lib: fix install_dir()
@@ -10,8 +10,6 @@ Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
utilities/ovs-lib.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
-diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
-index 1bccea0c5..457297f3f 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -157,7 +157,10 @@ install_dir () {
@@ -20,12 +18,9 @@ index 1bccea0c5..457297f3f 100644
if test ! -d "$DIR"; then
- install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
+ mkdir -p "$DIR"
-+ chmod "$INSTALL_MODE"
++ chmod "$INSTALL_MODE" "$DIR"
+ chown "$INSTALL_USER" "$DIR"
+ chgrp "$INSTALL_GROUP" "$DIR"
restorecon "$DIR" >/dev/null 2>&1
fi
}
---
-2.16.2
-