summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
diff options
context:
space:
mode:
Diffstat (limited to 'os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh')
-rwxr-xr-xos-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
new file mode 100755
index 00000000..7267969c
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
@@ -0,0 +1,42 @@
+#!/bin/ash
+# 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
+#
+# XEN specific init hook to create a bridge on the active network interface
+#############################################################################
+
+# configure Xen bridge xenbr0 (would it be possible to make it just br0?)
+
+modprobe ${MODPRV} netloop
+local ipls
+local vifnum="0"
+local bridge="xenbr${vifnum}"
+local netdev="eth${vifnum}" # should be ${nwif}
+local pdev="p${netdev}"
+local vdev="veth${vifnum}"
+local vif0="vif0.${vifnum}"
+# fixme: that is the mac address of main ethernet device
+local mac=${macaddr}
+
+brctl addbr ${bridge}
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+brctl addif ${bridge} ${vif0}
+for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
+ "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
+ "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
+ "${bridge} up" "${vif0} up" "${pdev} up" ; do
+ ip link set ${ipls}
+done
+brctl addif ${bridge} ${pdev}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}