summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/qemukvm/files
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-03-06 01:39:59 +0100
committerDirk von Suchodoletz2009-03-06 01:39:59 +0100
commitebd0e5ee18b6d8c7af9324406e1ae0500ee826bf (patch)
tree8f074c5974a7b6f46275baf87ab0d7010cee3f27 /os-plugins/plugins/qemukvm/files
parentThe ModulPath seems not needed to be set (so better comment it out to be (diff)
downloadcore-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.tar.gz
core-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.tar.xz
core-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.zip
More work on the qemukvm plugin ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2686 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/qemukvm/files')
-rw-r--r--os-plugins/plugins/qemukvm/files/qemu-ifup33
-rw-r--r--os-plugins/plugins/qemukvm/files/qemu-ifup.sudo45
2 files changed, 29 insertions, 49 deletions
diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup b/os-plugins/plugins/qemukvm/files/qemu-ifup
index 26707b8b..b6b9337c 100644
--- a/os-plugins/plugins/qemukvm/files/qemu-ifup
+++ b/os-plugins/plugins/qemukvm/files/qemu-ifup
@@ -10,11 +10,36 @@
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# qemu-ifup
-# - Wrapper script for running certain stuff priviledged
+# - Script used for network setup of qemukvm in Stage4
# -----------------------------------------------------------------------------
-# Run the real action script with sudo - this script should have been added
-# during SLX stage3 to the sudoers list.
+# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX
+# environments.
+brctlcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\
+ /opt/openslx/uclib-rootfs/usr/sbin/brctl"
+dhcpdcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\
+ /opt/openslx/uclib-rootfs/usr/sbin/udhcpd"
+
+# Just decide by the virtual network device used which kind of connection
+# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly.
+case "$1" in
+ tap0)
+ # Adding the tap0 interface to the existing bridge configured in stage3
+ eval $brctlcmd addif br0 tap0
+ ;;
+ tap1)
+ # Configuring DHCP on host tap1 interface and enable IP masquerading
+ mkdir /var/lib/qemu
+ sed "s,NWIF,tap1,;s,/misc,/qemu," /etc/opt/openslx/udhcpd.qemukvm \
+ >/var/lib/qemu/udhcpd.conf
+ eval $dhcpdcmd /var/lib/qemu/udhcpd.conf
+ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding
+ echo "1" >/proc/sys/net/ipv4/conf/tap1/forwarding
+ iptables -t nat -A POSTROUTING -i tap1 -o br0 -j MASQUERADE
+ ;;
+ tap2)
+ :
+ ;;
+esac
-sudo /etc/opt/openslx/qemu-ifup.sudo
diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo b/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo
deleted file mode 100644
index 0c9187b5..00000000
--- a/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2009 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# qemu-ifup.sudo
-# - Script used for network setup of qemukvm in Stage4
-# -----------------------------------------------------------------------------
-
-# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX
-# environments.
-brctlcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\
- /opt/openslx/uclib-rootfs/usr/sbin/brctl"
-dhcpdcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\
- /opt/openslx/uclib-rootfs/usr/sbin/udhcpd"
-
-# Just decide by the virtual network device used which kind of connection
-# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly.
-case "$1" in
- tap0)
- # Adding the tap0 interface to the existing bridge configured in stage3
- eval $brctlcmd addif br0 tap0
- ;;
- tap1)
- # Configuring DHCP on host tap1 interface and enable IP masquerading
- mkdir /var/lib/qemu
- sed "s,NWIF,tap1,;s,/misc,/qemu," /etc/opt/openslx/udhcpd.qemukvm \
- >/var/lib/qemu/udhcpd.conf
- eval $dhcpdcmd /var/lib/qemu/udhcpd.conf
- echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding
- echo "1" >/proc/sys/net/ipv4/conf/tap1/forwarding
- iptables -t nat -A POSTROUTING -i tap1 -o br0 -j MASQUERADE
- ;;
- tap2)
- :
- ;;
-esac
-
-