Browse Source

Merge pull request #314 from commodo/openvswitch-feed

openvswitch: initial feed at OpenVSwitch version 2.3
lilik-openwrt-22.03
sbyx 10 years ago
parent
commit
507878dac5
5 changed files with 349 additions and 0 deletions
  1. +207
    -0
      net/openvswitch/Makefile
  2. +37
    -0
      net/openvswitch/files/etc/init.d/openvswitch.init
  3. +41
    -0
      net/openvswitch/patches/0001-netdev-linux-Let-interface-flag-survive-internal-por.patch
  4. +28
    -0
      net/openvswitch/patches/0002-netdev-linux-Use-unsigned-int-for-ifi_flags.patch
  5. +36
    -0
      net/openvswitch/patches/0003-lib-util.h-Disable-ovs_assert-when-build-with-NDEBUG.patch

+ 207
- 0
net/openvswitch/Makefile View File

@ -0,0 +1,207 @@
#
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile $
include $(TOPDIR)/rules.mk
PKG_NAME:=openvswitch
PKG_RELEASE:=1
PKG_VERSION:=2.3.0
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILE:=COPYING
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=2b70c4b929d18d1f36dcdeb71ea5c383cbb662e9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_FIXUP=libtool
define Package/openvswitch/Default
SECTION:=net
CATEGORY:=Network
URL:=http://www.openvswitchswitch.org/
DEPENDS:=+libopenssl +librt +libpcap +libatomic
MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
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-common
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch
endef
define Package/openvswitch-common/description
openvswitch-common provides components required by both openvswitch-switch and
openvswitch-controller.
endef
define Package/openvswitch-ipsec
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
DEPENDS:=+openvswitch-common
endef
define Package/openvswitch-ipsec/description
The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
IPsec.
endef
define Package/openvswitch-benchmark
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
DEPENDS:=+openvswitch-common
endef
define Package/openvswitch-benchmark/description
Utility for running OpenVSwitch benchmarking
endef
define Package/openvswitch-controller
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
DEPENDS:=+openvswitch-common
endef
define Package/openvswitch-controller/description
The Open vSwitch controller enables OpenFlow switches that connect to it to
act as MAC-learning Ethernet switches.
endef
define Package/openvswitch-switch
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package
DEPENDS:=+openvswitch-common
endef
define Package/openvswitch-switch/description
openvswitch-switch provides the userspace components and utilities for the
Open vSwitch kernel-based switch.
endef
define KernelPackage/openvswitch
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
TITLE:=Open vSwitch Kernel Package
KCONFIG:=CONFIG_BRIDGE
DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c
FILES:= \
$(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,21,openvswitch)
endef
define KernelPackage/openvswitch/description
This package contains the Open vSwitch kernel moodule and bridge compat
module. Furthermore, it supports OpenFlow.
endef
CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
CONFIGURE_ARGS += --enable-ndebug
CONFIGURE_ARGS += --disable-ssl
CONFIGURE_ARGS += --enable-shared
TARGET_CFLAGS += -flto
define Build/Configure
(cd $(PKG_BUILD_DIR); \
autoreconf -v --install --force || exit 1 \
);
$(call Build/Configure/Default,$(CONFIGURE_ARGS))
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
STAGING_DIR="$(STAGING_DIR)" \
DESTDIR="$(PKG_INSTALL_DIR)/usr" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
PATH="$(TARGET_PATH)" \
KCC="$(KERNEL_CC)"
endef
define Package/openvswitch-ipsec/install
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
endef
define Package/openvswitch-benchmark/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
endef
define Package/openvswitch-common/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_BUILD_DIR)/lib/.libs/libsflow-$(PKG_VERSION).so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).so $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
endef
define Package/openvswitch-common/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
endef
define Package/openvswitch-controller/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-controller $(1)/usr/bin/
endef
define Package/openvswitch-switch/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/share/openvswitch/
$(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
endef
$(eval $(call BuildPackage,openvswitch-ipsec))
$(eval $(call BuildPackage,openvswitch-common))
$(eval $(call BuildPackage,openvswitch-controller))
$(eval $(call BuildPackage,openvswitch-switch))
$(eval $(call BuildPackage,openvswitch-benchmark))
$(eval $(call KernelPackage,openvswitch))

+ 37
- 0
net/openvswitch/files/etc/init.d/openvswitch.init View File

@ -0,0 +1,37 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014 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
}
# 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_close_instance
# 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_close_instance
}

+ 41
- 0
net/openvswitch/patches/0001-netdev-linux-Let-interface-flag-survive-internal-por.patch View File

@ -0,0 +1,41 @@
From b9284f535e93c337ab21f330753e60e1038f9a27 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 2/2] netdev-linux: Let interface flag survive internal port
setup
Due to a race condition when bringing up an internal port on Linux
some interface flags (e.g. IFF_MULTICAST) are falsely reset. This
happens because netlink events may be processed after the according
netdev has been brought up (which sets interface flags).
Fix this by reading the interface flags just before updating them
if they have not been updated by from the kernel yet.
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 9eaac33..423e72e 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2569,7 +2569,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
unsigned int old_flags, new_flags;
int error = 0;
- old_flags = netdev->ifi_flags;
+ if (!(netdev->cache_valid & VALID_DRVINFO)) {
+ /* Most likely the debvice flags are not in sync yet, fetch them now */
+ get_flags(&netdev->up, &old_flags);
+ } else {
+ old_flags = netdev->ifi_flags;
+ }
+
*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) {
--
1.8.1.4

+ 28
- 0
net/openvswitch/patches/0002-netdev-linux-Use-unsigned-int-for-ifi_flags.patch View File

@ -0,0 +1,28 @@
From 12edcd800d924f69630768eeece842373dee5bb0 Mon Sep 17 00:00:00 2001
From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Wed, 8 Jan 2014 13:48:33 +0100
Subject: [PATCH 1/2] netdev-linux: Use unsigned int for ifi_flags
ifi_flags is unsigned, the local equivalents should do the same.
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 9bdbbdf..9eaac33 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2566,7 +2566,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
enum netdev_flags on, enum netdev_flags *old_flagsp)
OVS_REQUIRES(netdev->mutex)
{
- int old_flags, new_flags;
+ unsigned int old_flags, new_flags;
int error = 0;
old_flags = netdev->ifi_flags;
--
1.8.1.4

+ 36
- 0
net/openvswitch/patches/0003-lib-util.h-Disable-ovs_assert-when-build-with-NDEBUG.patch View File

@ -0,0 +1,36 @@
From 34b51e26555d05c00b2320f943a645added5dae4 Mon Sep 17 00:00:00 2001
From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Mon, 9 Dec 2013 14:15:11 +0100
Subject: [PATCH 5/6] lib/util.h: Disable ovs_assert when build with NDEBUG
Reduces binary size. Use a static inline function instead of
a macro to not get "unused variable" warning everywhere.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
lib/util.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/util.h b/lib/util.h
index 5c23962..9e5866d 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -69,10 +69,15 @@
* - Writes the failure message to the log.
*
* - Not affected by NDEBUG. */
+#ifndef NDEBUG
#define ovs_assert(CONDITION) \
if (!OVS_LIKELY(CONDITION)) { \
ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION); \
}
+#else
+static inline void ovs_assert(bool cond OVS_UNUSED) {}
+#endif
+
void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN;
/* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes
--
1.8.1.4

Loading…
Cancel
Save