mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-21 17:44:31 +08:00
Compare commits
1 Commits
sysmngr_me
...
openvswitc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b1986c99e |
61
openvwrt-master/README.md
Normal file
61
openvwrt-master/README.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
OpenvWrt
|
||||||
|
===================
|
||||||
|
|
||||||
|
Open vSwitch 2.3.0 (OvS) package for OpenWrt "CHAOS CALMER" (trunk, r42165)
|
||||||
|
|
||||||
|
From NOW, OpenvSwitch had been add to [OpenWrt Packages Repository](https://github.com/openwrt/packages/tree/master/net/openvswitch), so support has ended.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation in OpenWrt
|
||||||
|
|
||||||
|
1. cd $TOPDIR
|
||||||
|
|
||||||
|
2. echo 'src-git openvswitch git://github.com/pichuang/openvwrt.git' >> feeds.conf
|
||||||
|
|
||||||
|
3. ./scripts/feeds update openvswitch
|
||||||
|
|
||||||
|
4. ./scripts/feeds install -a -p openvswitch
|
||||||
|
|
||||||
|
5. wget https://gist.githubusercontent.com/pichuang/7372af6d5d3bd1db5a88/raw/4e2290e3e184288de7623c02f63fb57c536e035a/openwrt-add-libatomic.patch -q -O - | patch -p1
|
||||||
|
|
||||||
|
6. make menuconfig
|
||||||
|
* select Network -> openvswitch-switch, openvswitch-switch, openvswitch-ipsec (Optional)
|
||||||
|
* select Advanced configuration options (for developers) -> Toolchain Options -> Binutils Version -> Linaro binutils 2.24
|
||||||
|
* UNSELECT Advanced configuration options (for developers) -> Target Options -> Build packages with MIPS16 instructions
|
||||||
|
|
||||||
|
7. echo '#CONFIG_KERNEL_BRIDGE is not set' >> .config
|
||||||
|
|
||||||
|
8. make V=s
|
||||||
|
|
||||||
|
**!WARNING!** You need repeat step 7 and 8 after you enter "make menuconfig".
|
||||||
|
|
||||||
|
|
||||||
|
## Enviroment
|
||||||
|
* Hardware: D-LINK Dir-835
|
||||||
|
* Build enviroment
|
||||||
|
* gcc version 4.9.0 20140604 (prerelease) (GCC)
|
||||||
|
* Ubuntu 14.04.1 x86_64
|
||||||
|
|
||||||
|
Q&A
|
||||||
|
---
|
||||||
|
|
||||||
|
1. How to build OpenWrt?
|
||||||
|
* Please read [Roan's blog Compiled OpenWrt](http://roan.logdown.com/posts/165911-compiled-openwrt)
|
||||||
|
|
||||||
|
2. How to set OpenvSwitch configuration?
|
||||||
|
* Please read [Roan's blog Set OpenvSwitch](http://roan.logdown.com/posts/191801-set-openvswitch)
|
||||||
|
|
||||||
|
3. No works?
|
||||||
|
* Try reboot and ```telnet 192.168.1.1```
|
||||||
|
* or, ```make clean``` rebuild it.
|
||||||
|
|
||||||
|
Screenshot
|
||||||
|
----------
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Development
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Please fork on github and send pull requests.
|
||||||
|
|
||||||
162
openvwrt-master/openvswitch/Makefile
Normal file
162
openvwrt-master/openvswitch/Makefile
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2013 Julius Schulz-Zander
|
||||||
|
#
|
||||||
|
# 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_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=http://openvswitch.org/releases/
|
||||||
|
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
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
|
||||||
|
MAINTAINER:=Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
|
||||||
|
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 Flow Switch Userspace Package
|
||||||
|
DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/openvswitch-common/description
|
||||||
|
openvswitch-common provides components required by both openvswitch-switch and
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/openvswitch-ipsec
|
||||||
|
$(call Package/openvswitch/Default)
|
||||||
|
TITLE:=Open Flow Switch 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-switch
|
||||||
|
$(call Package/openvswitch/Default)
|
||||||
|
TITLE:=Open Flow Switch 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 Flow Data Path Drivers
|
||||||
|
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
|
||||||
|
|
||||||
|
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-common/install
|
||||||
|
$(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-appctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-benchmark $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-ofctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-pki $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/vtep/vtep-ctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-client $(1)/usr/bin/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/bugtool/ovs-bugtool $(1)/usr/sbin/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/openvswitch-common/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/openvswitch-switch/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-dpctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-pcap $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-tcpundump $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-vsctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-tool $(1)/usr/bin/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/ovs-vswitchd $(1)/usr/sbin/
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-server $(1)/usr/sbin/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/openvswitch/
|
||||||
|
$(INSTALL_BIN) $(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-switch))
|
||||||
|
$(eval $(call KernelPackage,openvswitch))
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2013 Julius Schulz-Zander
|
||||||
|
|
||||||
|
START=99
|
||||||
|
# DEBUG="echo"
|
||||||
|
|
||||||
|
start() {
|
||||||
|
[ -x /etc/openvswitch ] || mkdir -p /etc/openvswitch
|
||||||
|
[ -x /var/run/openvswitch ] || mkdir -p /var/run/openvswitch
|
||||||
|
[ -e /etc/openvswitch/conf.db ] || {
|
||||||
|
$DEBUG /usr/bin/ovsdb-tool create /etc/openvswitch/conf.db \
|
||||||
|
/usr/share/openvswitch/vswitch.ovsschema
|
||||||
|
}
|
||||||
|
|
||||||
|
$DEBUG start-stop-daemon -q -S -x /usr/sbin/ovsdb-server -- \
|
||||||
|
--remote=punix:/var/run/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
|
||||||
|
--pidfile=/var/run/ovsdb-server.pid --detach --log-file=/var/log/ovsdb-server.log
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
$DEBUG ovs-vsctl --no-wait init
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
$DEBUG start-stop-daemon -q -S -x /usr/sbin/ovs-vswitchd -- \
|
||||||
|
--pidfile=/var/run/ovs-vswitchd.pid --detach --log-file=/var/log/ovs-vswitchd.log
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
$DEBUG start-stop-daemon -q -K -p /var/run/ovsdb-server.pid
|
||||||
|
$DEBUG start-stop-daemon -q -K -p /var/run/ovs-vswitchd.pid
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
ifdown -a
|
||||||
|
sleep 1
|
||||||
|
ifup -a
|
||||||
|
start
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user