summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
diff options
context:
space:
mode:
authorMichael Janczyk2010-07-04 20:55:55 +0200
committerMichael Janczyk2010-07-04 20:55:55 +0200
commit4578a3dd6491fc1c5a0eeecd3e66a93bdae7aafa (patch)
treecd8a4f0594ae08d5819f4015903b0c385998bd1d /os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
parentslxos-plugin install <vendorOS> plugin plugin::attribute1="foo=bar=baz" (diff)
downloadcore-4578a3dd6491fc1c5a0eeecd3e66a93bdae7aafa.tar.gz
core-4578a3dd6491fc1c5a0eeecd3e66a93bdae7aafa.tar.xz
core-4578a3dd6491fc1c5a0eeecd3e66a93bdae7aafa.zip
changed copyright years, added ovz plugin stubs
Diffstat (limited to 'os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh')
-rwxr-xr-xos-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..6aabe8ad
--- /dev/null
+++ b/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/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
+#
+# 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}