diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch | 60 | ||||
-rw-r--r-- | main/openvswitch/APKBUILD | 109 | ||||
-rw-r--r-- | main/openvswitch/ifupdown-alpine.patch | 51 | ||||
-rwxr-xr-x | main/openvswitch/ifupdown.sh | 99 | ||||
-rw-r--r-- | main/openvswitch/musl-if_packet.patch | 14 | ||||
-rw-r--r-- | main/openvswitch/ovs-modules.initd | 25 | ||||
-rw-r--r-- | main/openvswitch/ovs-vswitchd.confd | 6 | ||||
-rw-r--r-- | main/openvswitch/ovs-vswitchd.initd | 25 | ||||
-rw-r--r-- | main/openvswitch/ovsdb-server.confd | 16 | ||||
-rw-r--r-- | main/openvswitch/ovsdb-server.initd | 50 |
10 files changed, 455 insertions, 0 deletions
diff --git a/main/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch b/main/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch new file mode 100644 index 0000000000..2a7ae57b30 --- /dev/null +++ b/main/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch @@ -0,0 +1,60 @@ +From 92ae6e162812876c082fd9d05a0eeac062f832ae Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Mon, 25 Aug 2014 08:50:26 +0000 +Subject: [PATCH] ovs-thread: Set stacksize to 1M + +With musl libc the default stacksize is 80k which is too small and +makes it segfault. + +We increase it to 1MB. +http://permalink.gmane.org/gmane.linux.network.openvswitch.general/5831 + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + lib/ovs-thread.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff -ru openvswitch-2.3.0.orig/lib/ovs-thread.c openvswitch-2.3.0/lib/ovs-thread.c +--- openvswitch-2.3.0.orig/lib/ovs-thread.c 2014-10-02 14:37:47.196714056 -0300 ++++ openvswitch-2.3.0/lib/ovs-thread.c 2014-10-02 14:38:10.826714288 -0300 +@@ -28,6 +28,9 @@ + #include "socket-util.h" + #include "util.h" + ++/* set default stack size to 1M */ ++#define OVS_STACK_SIZE (1024 * 1024) ++ + #ifdef __CHECKER__ + /* Omit the definitions in this file because they are somewhat difficult to + * write without prompting "sparse" complaints, without ugliness or +@@ -329,6 +332,7 @@ + { + struct ovsthread_aux *aux; + pthread_t thread; ++ pthread_attr_t attr; + int error; + + forbid_forking("multiple threads exist"); +@@ -340,10 +344,21 @@ + aux->arg = arg; + ovs_strlcpy(aux->name, name, sizeof aux->name); + +- error = pthread_create(&thread, NULL, ovsthread_wrapper, aux); ++ error = pthread_attr_init(&attr); ++ if (error) { ++ ovs_abort(error, "pthread_attr_init failed"); ++ } ++ error = pthread_attr_setstacksize(&attr, OVS_STACK_SIZE); ++ if (error) { ++ ovs_abort(error, "pthread_attr_setstacksize failed"); ++ } ++ ++ error = pthread_create(&thread, &attr, ovsthread_wrapper, aux); + if (error) { + ovs_abort(error, "pthread_create failed"); + } ++ pthread_attr_destroy(&attr); ++ + return thread; + } + diff --git a/main/openvswitch/APKBUILD b/main/openvswitch/APKBUILD new file mode 100644 index 0000000000..4d7e4a51a0 --- /dev/null +++ b/main/openvswitch/APKBUILD @@ -0,0 +1,109 @@ +# Contributor: Stuart Cardall <developer@it-offshore.co.uk> +# Maintainer: Stuart Cardall <developer@it-offshore.co.uk> +pkgname=openvswitch +pkgver=2.3.0 +pkgrel=6 +pkgdesc="A production quality, multilayer virtual switch" +url="http://openvswitch.org/" +arch="all" +license="ASL 2.0" +depends="" +depends_dev="openssl-dev" +makedepends="$depends_dev perl python" +install="" +subpackages="$pkgname-doc $pkgname-dbg $pkgname-monitor" +source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz + ovsdb-server.initd + ovsdb-server.confd + ovs-vswitchd.initd + ovs-vswitchd.confd + ovs-modules.initd + musl-if_packet.patch + 0001-ovs-thread-Set-stacksize-to-1M.patch + ifupdown-alpine.patch + " + +_builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + local i + cd "$_builddir" + + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --enable-ndebug \ + || return 1 + make || return 1 +} + +monitor() { + depends="openvswitch py-twisted py-twisted-web2 py-qt" + arch="noarch" + mkdir -p "$subpkgdir"/usr/share/openvswitch + mv "$pkgdir"/usr/share/openvswitch/python \ + "$subpkgdir"/usr/share/openvswitch/python +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install || return 1 + rm -f "$pkgdir"/usr/lib/*.la + rm -f "$pkgdir"/usr/lib/*.a + install -Dm755 "$srcdir"/ovsdb-server.initd \ + "$pkgdir"/etc/init.d/ovsdb-server || return 1 + install -Dm755 "$srcdir"/ovs-vswitchd.initd \ + "$pkgdir"/etc/init.d/ovs-vswitchd || return 1 + install -Dm755 "$srcdir"/ovs-modules.initd \ + "$pkgdir"/etc/init.d/ovs-modules || return 1 + install -Dm644 "$srcdir"/ovsdb-server.confd \ + "$pkgdir"/etc/conf.d/ovsdb-server || return 1 + install -Dm644 "$srcdir"/ovs-vswitchd.confd \ + "$pkgdir"/etc/conf.d/ovs-vswitchd + + install -d "$pkgdir"/etc/network/if-pre-up.d \ + "$pkgdir"/etc/network/if-post-down.d || return 1 + install -m755 debian/ifupdown.sh \ + "$pkgdir"/etc/network/if-pre-up.d/openvswitch || return 1 + ln -s ../if-pre-up.d/openvswitch \ + "$pkgdir"/etc/network/if-post-down.d/openvswitch || return 1 +} + +md5sums="9c4d1471a56718132e0157af1bfc9310 openvswitch-2.3.0.tar.gz +b31c5fff2ba358dc6af49ab6ffcdecbf ovsdb-server.initd +f10a8ac784654bec359bda52779f16fe ovsdb-server.confd +93e79e5a556e6fe03121cf7b63f7f2a2 ovs-vswitchd.initd +2d1e0111ea62779f49e14d62678294b2 ovs-vswitchd.confd +ae128e5c349710c0fb3849b2d3b3aa40 ovs-modules.initd +6e17032bd6e7caf6e6e844b5a84d7080 musl-if_packet.patch +59fa9a6d293a25571562a5190ae559f2 0001-ovs-thread-Set-stacksize-to-1M.patch +efb3c073b7c475d9fb3999a38e4f92c0 ifupdown-alpine.patch" +sha256sums="011052645cd4c7afee2732e87d45e589a0540ac7b7523027d3be2d7c7db7c899 openvswitch-2.3.0.tar.gz +d7791b1e7e84955489f88e457631c6cedfeff26c5865c8569b69e1bd96633dc7 ovsdb-server.initd +d0d8a6a7256f4cc47ab1b9f9f7657202388133bcfff3668e7c1d4adbcc572261 ovsdb-server.confd +be2c3d3df016462a5d633ec24faf7cb9f3e5ff87f860d9a5e65571d167e90d38 ovs-vswitchd.initd +cc189d5ca24708ff775a4de312df3f611c65714724b8901ec6527c9e3f22e14a ovs-vswitchd.confd +94f4dba5e2ddedb9c91911b02dbfc41a5114e8a5066a8db3ef4444ebb5400173 ovs-modules.initd +d0e9e3e30b2943b10e7efa59c41c3bf8d5b599d55fc99198146bf4761df4d8ae musl-if_packet.patch +faf997814e89b0b5948c06050ef38051f0bc6b108958f76313263f77a724906c 0001-ovs-thread-Set-stacksize-to-1M.patch +d2284376febcdb465ef2f216be01be52dab2a9726624b12c5cc47fb0d955d1b1 ifupdown-alpine.patch" +sha512sums="f3a665bc84d8a6e282928db61ae648a826f273e44e34311a60e6f0e74a6ab10c8410cb374f0ce80abe7c58b9559a97388cdbfe2ef28ac4bedd2f5e52b3cd6ed1 openvswitch-2.3.0.tar.gz +7b6b0a3c42839053d21ff72b576d92ba08ee5d900faa25fa04a183114a55c4d7dc85538cd7d3333386a27d7a7f632c1d2a38a2b950972c29d11d96addaffa27c ovsdb-server.initd +b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5 ovsdb-server.confd +1b929c25a4b902122550003d23ae178580fa175c57427050c43504b33e212d3d76ff4f1f266a5f815165e9c014d044d8bf3815432fbd86c5f7ee854bcace6d94 ovs-vswitchd.initd +346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d ovs-vswitchd.confd +e1f88ff11cd1d5a4025626acad49411e8a2d5d7caa20d0a63ef0422a9b1bb55b070843327d8bb209e1e915d2a3f1c3bcae911acf40e0a419bc6cce6250239232 ovs-modules.initd +1ebfb2629081cc0b34383e6c2f163f3c1d43da3a399b8ba8745871b77029d3b8fc21a287ff859a6a9cca2cb4885715458d4e4086cb6c17765ff7c898d4004850 musl-if_packet.patch +5fed04e68b58ab322154fa1cc4c4b63b08c22ed41f0b7713dbe8437f7cb4e9fd93c8aba524c2e5a46bba956da9439f5bfe5ba6fcdff2b98fa9bbcc748c5b64db 0001-ovs-thread-Set-stacksize-to-1M.patch +eb24886fd8110adde4a68f7ab0887af0cdf88e27d58f030208a0a9d7aef0065b8c5f7e2d489ff48c82ba386fbb9575c0273c5d4958e2638263ea78824242354e ifupdown-alpine.patch" diff --git a/main/openvswitch/ifupdown-alpine.patch b/main/openvswitch/ifupdown-alpine.patch new file mode 100644 index 0000000000..e35b4aa64a --- /dev/null +++ b/main/openvswitch/ifupdown-alpine.patch @@ -0,0 +1,51 @@ +--- ./debian/ifupdown.sh.orig ++++ ./debian/ifupdown.sh +@@ -38,7 +38,8 @@ + ${OVS_EXTRA+-- $OVS_EXTRA} + + if [ ! -z "${IF_OVS_PORTS}" ]; then +- ifup --allow="${IFACE}" ${IF_OVS_PORTS} ++# ifup --allow="${IFACE}" ${IF_OVS_PORTS} ++ ifup ${IF_OVS_PORTS} + fi + ;; + OVSPort) +@@ -46,24 +47,24 @@ + "${IFACE}" ${IF_OVS_OPTIONS} \ + ${OVS_EXTRA+-- $OVS_EXTRA} + +- ifconfig "${IFACE}" up ++ ip link set dev "${IFACE}" up + ;; + OVSIntPort) + ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}"\ + type=internal ${OVS_EXTRA+-- $OVS_EXTRA} + +- ifconfig "${IFACE}" up ++ ip link set dev "${IFACE}" up + ;; + OVSBond) + ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_BONDS} ${IF_OVS_OPTIONS} \ + ${OVS_EXTRA+-- $OVS_EXTRA} + +- ifconfig "${IFACE}" up ++ ip link set dev "${IFACE}" up + for slave in ${IF_OVS_BONDS} + do +- ifconfig "${slave}" up ++ ip link set dev "${slave}" up + done + ;; + OVSTunnel) +@@ -80,7 +81,8 @@ + case "${IF_OVS_TYPE}" in + OVSBridge) + if [ ! -z "${IF_OVS_PORTS}" ]; then +- ifdown --allow="${IFACE}" ${IF_OVS_PORTS} ++# ifdown --allow="${IFACE}" ${IF_OVS_PORTS} ++ ifdown ${IF_OVS_PORTS} + fi + + ovs_vsctl -- --if-exists del-br "${IFACE}" diff --git a/main/openvswitch/ifupdown.sh b/main/openvswitch/ifupdown.sh new file mode 100755 index 0000000000..9c0054f7d0 --- /dev/null +++ b/main/openvswitch/ifupdown.sh @@ -0,0 +1,99 @@ +#! /bin/sh + +# Copyright (c) 2012, 2013 Nicira, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Have a look at /usr/share/doc/openvswitch-switch/README.Debian +# for more information about configuring the /etc/network/interfaces. + +if [ -z "${IF_OVS_TYPE}" ]; then + exit 0 +fi + +ovs_vsctl() { + ovs-vsctl --timeout=5 "$@" +} + +if (ovs_vsctl --version) > /dev/null 2>&1; then :; else + exit 0 +fi + +if [ "${MODE}" = "start" ]; then + eval OVS_EXTRA=\"${IF_OVS_EXTRA}\" + + case "${IF_OVS_TYPE}" in + OVSBridge) + ovs_vsctl -- --may-exist add-br "${IFACE}" ${IF_OVS_OPTIONS}\ + ${OVS_EXTRA+-- $OVS_EXTRA} + + if [ ! -z "${IF_OVS_PORTS}" ]; then +# ifup --allow="${IFACE}" ${IF_OVS_PORTS} + ifup ${IF_OVS_PORTS} + fi + ;; + OVSPort) + ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_OPTIONS} \ + ${OVS_EXTRA+-- $OVS_EXTRA} + + ip link set dev "${IFACE}" up + ;; + OVSIntPort) + ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}"\ + type=internal ${OVS_EXTRA+-- $OVS_EXTRA} + + ip link set dev "${IFACE}" up + ;; + OVSBond) + ovs_vsctl -- --fake-iface add-bond "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_BONDS} ${IF_OVS_OPTIONS} \ + ${OVS_EXTRA+-- $OVS_EXTRA} + + ip link set dev "${IFACE}" up + for slave in ${IF_OVS_BONDS} + do + ip link set dev "${slave}" up + done + ;; + OVSTunnel) + ovs_vsctl -- --may-exist add-port "${IF_OVS_BRIDGE}"\ + "${IFACE}" ${IF_OVS_OPTIONS} -- set Interface "${IFACE}" \ + type=${IF_OVS_TUNNEL_TYPE} ${IF_OVS_TUNNEL_OPTIONS} \ + ${OVS_EXTRA+-- $OVS_EXTRA} + ;; + *) + exit 0 + ;; + esac +elif [ "${MODE}" = "stop" ]; then + case "${IF_OVS_TYPE}" in + OVSBridge) + if [ ! -z "${IF_OVS_PORTS}" ]; then +# ifdown --allow="${IFACE}" ${IF_OVS_PORTS} + ifdown ${IF_OVS_PORTS} + fi + + ovs_vsctl -- --if-exists del-br "${IFACE}" + ;; + OVSPort|OVSIntPort|OVSBond|OVSTunnel) + ovs_vsctl -- --if-exists del-port "${IF_OVS_BRIDGE}" "${IFACE}" + ;; + *) + exit 0 + ;; + esac +fi + +exit 0 diff --git a/main/openvswitch/musl-if_packet.patch b/main/openvswitch/musl-if_packet.patch new file mode 100644 index 0000000000..ff9d76119e --- /dev/null +++ b/main/openvswitch/musl-if_packet.patch @@ -0,0 +1,14 @@ +--- ./lib/netdev-linux.c.orig ++++ ./lib/netdev-linux.c +@@ -37,10 +37,9 @@ + #include <sys/types.h> + #include <sys/ioctl.h> + #include <sys/socket.h> +-#include <netpacket/packet.h> + #include <net/if.h> + #include <net/if_arp.h> +-#include <net/if_packet.h> ++#include <linux/if_packet.h> + #include <net/route.h> + #include <netinet/in.h> + #include <poll.h> diff --git a/main/openvswitch/ovs-modules.initd b/main/openvswitch/ovs-modules.initd new file mode 100644 index 0000000000..204348d735 --- /dev/null +++ b/main/openvswitch/ovs-modules.initd @@ -0,0 +1,25 @@ +#!/sbin/runscript + +MODULES="openvswitch" + +depend() { + before ovsdb-server +} + + +start() { + ebegin "Loading Openvswitch kernel modules" + for mod in $MODULES; do + modprobe -q $mod + done + eend $? +} + +stop() { + ebegin "Unloading Openvswitch kernel modules" + for mod in $MODULES; do + rmmod $mod + done + eend $? +} + diff --git a/main/openvswitch/ovs-vswitchd.confd b/main/openvswitch/ovs-vswitchd.confd new file mode 100644 index 0000000000..3c3d15865b --- /dev/null +++ b/main/openvswitch/ovs-vswitchd.confd @@ -0,0 +1,6 @@ +# Connection string for the configuration database (usually a unix socket) +DATABASE="unix:/var/run/openvswitch/db.sock" + +# Additional options +OPTIONS="--mlockall" + diff --git a/main/openvswitch/ovs-vswitchd.initd b/main/openvswitch/ovs-vswitchd.initd new file mode 100644 index 0000000000..1cc9b35a5f --- /dev/null +++ b/main/openvswitch/ovs-vswitchd.initd @@ -0,0 +1,25 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovs-vswitchd-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $ + +description="Open vSwitch virtual switch" + +pidfile="/var/run/openvswitch/ovs-vswitchd.pid" +command="/usr/sbin/ovs-vswitchd" +command_args=" + --pidfile=$pidfile + --detach + --monitor + ${OPTIONS} ${DATABASE}" + +depend() { + need localmount ovsdb-server + after bootmisc hwdrivers modules + before net + use logger +} + +start_pre() { + checkpath --directory "${pidfile%/*}" --mode 0750 +} diff --git a/main/openvswitch/ovsdb-server.confd b/main/openvswitch/ovsdb-server.confd new file mode 100644 index 0000000000..97367b9717 --- /dev/null +++ b/main/openvswitch/ovsdb-server.confd @@ -0,0 +1,16 @@ +# Socket for bringing the server up +DB_SOCKET="/var/run/openvswitch/db.sock" + +# Remote sockets are defined in the database by default +REMOTE_DB="db:Open_vSwitch,Open_vSwitch,manager_options" + +# All certificates and keys are stored in the database (if any) +PRIVATE_KEY="db:Open_vSwitch,SSL,private_key" +CERTIFICATE="db:Open_vSwitch,SSL,certificate" +BOOTSTRAP_CA_CERT="db:Open_vSwitch,SSL,ca_cert" + +# Alternative path for the database (default is /etc/openvswitch/conf.db) +# DATABASE="/etc/openvswitch/conf.db" + +# Additional options +# OPTIONS="" diff --git a/main/openvswitch/ovsdb-server.initd b/main/openvswitch/ovsdb-server.initd new file mode 100644 index 0000000000..29d19045fe --- /dev/null +++ b/main/openvswitch/ovsdb-server.initd @@ -0,0 +1,50 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvswitch/files/ovsdb-server-r1,v 1.1 2013/04/08 19:37:58 dev-zero Exp $ + +description="Open vSwitch database server" + +remote_punix=${DB_SOCKET:+"--remote=punix:${DB_SOCKET}"} +remote_db=${REMOTE_DB:+"--remote=${REMOTE_DB}"} +private_key=${PRIVATE_KEY:+"--private-key=${PRIVATE_KEY}"} +certificate=${CERTIFICATE:+"--certificate=${CERTIFICATE}"} +bootstrap_ca_cert=${BOOTSTRAP_CA_CERT:+"--bootstrap-ca-cert=${BOOTSTRAP_CA_CERT}"} + +db=${DATABASE:-/etc/openvswitch/conf.db} +dbschema=/usr/share/openvswitch/vswitch.ovsschema + +command="/usr/sbin/ovsdb-server" +command_args=" + --pidfile + --detach + --monitor + ${remote_punix} + ${remote_db} + ${private_key} + ${certificate} + ${bootstrap_ca_cert} + ${DATABASE} + ${OPTIONS}" +pidfile="/var/run/openvswitch/ovsdb-server.pid" + + +depend() { + need localmount dev + after bootmisc hwdrivers modules + before net + use logger +} + +# ovsdb-server is a hard dependency for ovs-vswitchd (to keep them in sync) - to stop the db only: +# /etc/init.d/ovsdb-server --nodeps stop |or| rc-service ovsdb-server -- --nodeps stop + +start_pre() { + checkpath -d "/var/run/openvswitch" -m 0750 + if ! [ -e "$db" ]; then + ovsdb-tool create $db $dbschema + elif [ "$(ovsdb-tool needs-conversion $db $dbschema)" = "yes" ]; then + ovsdb-tool convert $db $dbschema + fi +} + |