diff options
Diffstat (limited to 'network/vde2')
-rw-r--r-- | network/vde2/README | 48 | ||||
-rw-r--r-- | network/vde2/doinst.sh | 23 | ||||
-rw-r--r-- | network/vde2/rc.vde2 | 74 | ||||
-rw-r--r-- | network/vde2/slack-desc | 19 | ||||
-rwxr-xr-x | network/vde2/vde2.SlackBuild | 95 | ||||
-rw-r--r-- | network/vde2/vde2.info | 10 |
6 files changed, 269 insertions, 0 deletions
diff --git a/network/vde2/README b/network/vde2/README new file mode 100644 index 0000000000000..c5595558df17c --- /dev/null +++ b/network/vde2/README @@ -0,0 +1,48 @@ +VDE is an ethernet compliant virtual network which includes tools such +as 'vde_switch' and 'vdeqemu'. VDE switch has several virtual ports +where virtual machines, applications, virtual interfaces and +connectivity tools can be virtually plugged in. VDE qemu works as a +wrapper for running qemu virtual machines that connects transparently +to a specified vde_switch + +VDE is dependant upon TUN/TAP support in the Linux Kernel; this comes +enabled by default with Slackware 13's 'generic' kernel. To enable +TUN/TAP support manually, you must set the following entry in your +kernel's '.config' file and recompile: + CONFIG_TUN=m + +## Configuration +An init script has been provided in /etc/rc.d/rc.vde2 to use with +vde_switch. Edit this script and provide the TAP inteface name as +well as the subnet for your Virtual Switch to use. Do NOT choose +a subnet which is already in use. More than likely, the default +values will work fine. + +## VDE + Qemu/kvm +A common usage for vde_switch is to be able to have emulated OS's +via Qemu behave as if they were actually attached to a Local Network. +To enable this functionality with Qemu, replace any calls to 'qemu' +with the following command: + +vdeqemu -net vde,vlan=0 -net nic,vlan=0,macaddr=AA:BB:CC:DD:EE:FF + +Note that the 'macaddr' string is optional but can prove to be +quite useful when used in conjuction with a DHCP server (such as +dhcpd or dnsmasq) to assign IP's based upon MAC address. + +Do not forget to include the options which point vdeqemu to your +ISO image to boot along with any other options you may have used +with 'qemu' such as -localtime, -nographic etc. + +## Startup +To have this start upon each boot, add the following lines to +/etc/rc.d/rc.local and make sure rc.vde2 is executable. + + # Start vde_switch + if [ -x /etc/rc.d/rc.vde2 ]; then + /etc/rc.d/rc.vde2 start + fi + +## For more information you can check: +http://wiki.virtualsquare.org +http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:vde&s=qemu diff --git a/network/vde2/doinst.sh b/network/vde2/doinst.sh new file mode 100644 index 0000000000000..9c1d24ce7f23f --- /dev/null +++ b/network/vde2/doinst.sh @@ -0,0 +1,23 @@ +#!/bin/sh +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.vde2.new: +if [ -e etc/rc.d/rc.vde2 ]; then + cp -a etc/rc.d/rc.vde2 etc/rc.d/rc.vde2.new.incoming + cat etc/rc.d/rc.vde2.new > etc/rc.d/rc.vde2.new.incoming + mv etc/rc.d/rc.vde2.new.incoming etc/rc.d/rc.vde2.new +fi + +config etc/rc.d/rc.vde2.new + diff --git a/network/vde2/rc.vde2 b/network/vde2/rc.vde2 new file mode 100644 index 0000000000000..9cc1beceb0636 --- /dev/null +++ b/network/vde2/rc.vde2 @@ -0,0 +1,74 @@ +#!/bin/sh + +#=========================== EDIT THE FOLLOWING VARIABLES ========================== +# _________________________________________________________________________________ +# | | +# | Interface name to use for the TAP device | +# | | + TAP_IF="tap0" +# |_________________________________________________________________________________| +# | | +# | IP Address/Subnet in CIDR Notation for the Virtual Network | +# | | + TAP_NET="10.10.10.1/24" +# |_________________________________________________________________________________| +# +#=========================== DO NOT EDIT BELOW THIS LINE ============================ + +start(){ + echo -n "Starting VDE Switch..." + + # Load tun module + modprobe tun || { echo "Error, cannot load 'tun' module. Exiting..." ; exit 1 ; } + sleep 1 + + # Start tap switch + vde_switch -tap ${TAP_IF} -daemon || { echo "Error, cannot assign IP to ${TAP_IF}. Exiting..." ; exit 1 ; } + + # Bring tap interface up + ip addr add ${TAP_NET} dev ${TAP_IF} + ip link set ${TAP_IF} up + + #chmod 666 /tmp/vde.ctl + chmod -R a+rwx /var/run/vde.ctl + + # Apply workaround + echo 1024 > /proc/sys/dev/rtc/max-user-freq + echo +} + + +stop(){ + echo -n "Stopping VDE Switch..." + + # Bring tap interface down + ip addr flush dev ${TAP_IF} + ip link set ${TAP_IF} down + + # Kill VDE switch + kill $(pgrep vde_switch) + sleep 1 + + # Remove tun module + modprobe -r tun + echo +} + + +case "$1" in + start) + start + ;; + + stop) + stop + ;; + + restart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + ;; +esac diff --git a/network/vde2/slack-desc b/network/vde2/slack-desc new file mode 100644 index 0000000000000..36ce486fe6f3f --- /dev/null +++ b/network/vde2/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +vde2: VDE (Virtual Distributed Ethernet) +vde2: +vde2: VDE is an ethernet compliant virtual network which includes tools such +vde2: as 'vde_switch' and 'vdeqemu'. VDE switch has several virtual ports +vde2: where virtual machines, applications, virtual interfaces and +vde2: connectivity tools can be virtually plugged in. VDE qemu works as a +vde2: wrapper for running qemu/kvm virtual machines that connects +vde2: transparently to a specified vde_switch +vde2: +vde2: Homepage: http://vde.sourceforge.net +vde2: diff --git a/network/vde2/vde2.SlackBuild b/network/vde2/vde2.SlackBuild new file mode 100755 index 0000000000000..c47b6c3520ef9 --- /dev/null +++ b/network/vde2/vde2.SlackBuild @@ -0,0 +1,95 @@ +#!/bin/sh + +# Slackware build script for vde2 + +# Copyright 2007-2008 Sean Donner (sean.donner@sbcglobal.net) +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified by Antonio Hernández Blas <hba.nihilismus@gmail.com> + +PRGNAM=vde2 +VERSION=2.2.3 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --datarootdir=/usr \ + --datadir=/usr/share \ + --enable-shared=yes \ + --disable-static \ + --build=$ARCH-slackware-linux + +make all +make install-strip DESTDIR=$PKG + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING* INSTALL README* doc \ + $PKG/usr/doc/$PRGNAM-$VERSION +rm -f $PKG/usr/doc/$PRGNAM-$VERSION/doc/Makefile* +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/etc/rc.d +install -m 0755 $CWD/rc.vde2 $PKG/etc/rc.d/rc.vde2.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/vde2/vde2.info b/network/vde2/vde2.info new file mode 100644 index 0000000000000..0b0ded97f711b --- /dev/null +++ b/network/vde2/vde2.info @@ -0,0 +1,10 @@ +PRGNAM="vde2" +VERSION="2.2.3" +HOMEPAGE="http://vde.sourceforge.net" +DOWNLOAD="http://downloads.sourceforge.net/project/vde/vde2/2.2.3/vde2-2.2.3.tar.bz2" +MD5SUM="6f59e47fe2c8872afd85d130d2193794" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Antonio Hernández Blas" +EMAIL="hba.nihilismus@gmail.com" +APPROVED="pprkut" |