summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/xen/init-hooks
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins/xen/init-hooks')
-rw-r--r--src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh4
-rwxr-xr-xsrc/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh30
2 files changed, 34 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh b/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
new file mode 100644
index 00000000..d514b68d
--- /dev/null
+++ b/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
@@ -0,0 +1,4 @@
+# load xennet if necessary, usualy within a NFS VM
+if grep -q "Xen Virtual Ethernet Card" /etc/hwinfo.netcard-usbctrl; then
+ modprobe xennet >/tmp/xennet.log 2>&1
+fi
diff --git a/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..d5245234
--- /dev/null
+++ b/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}