aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ioemu/target-i386-dm
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-04 11:01:46 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-04 11:01:46 +0100
commit06809a93ad31d88b1768e598f21de56d21a1559c (patch)
treec69464bb7c5ae3eb32c48de643499e8e1f946b36 /tools/ioemu/target-i386-dm
parentd18c70c4828a93ef440a6481c897d67230da7df3 (diff)
downloadxen-06809a93ad31d88b1768e598f21de56d21a1559c.tar.gz
xen-06809a93ad31d88b1768e598f21de56d21a1559c.tar.bz2
xen-06809a93ad31d88b1768e598f21de56d21a1559c.zip
[NET] Remove netloop from network bridge init scripts.
The scripts are partly based on work by Daniel P. Berrange. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'tools/ioemu/target-i386-dm')
-rw-r--r--tools/ioemu/target-i386-dm/qemu-ifup30
1 files changed, 29 insertions, 1 deletions
diff --git a/tools/ioemu/target-i386-dm/qemu-ifup b/tools/ioemu/target-i386-dm/qemu-ifup
index 1212ae8926..bdc5aecc0e 100644
--- a/tools/ioemu/target-i386-dm/qemu-ifup
+++ b/tools/ioemu/target-i386-dm/qemu-ifup
@@ -5,5 +5,33 @@
echo 'config qemu network with xen bridge for ' $*
+bridge=$2
+
+#
+# Old style bridge setup with netloop, used to have a bridge name
+# of xenbrX, enslaving pethX and vif0.X, and then configuring
+# eth0.
+#
+# New style bridge setup does not use netloop, so the bridge name
+# is ethX and the physical device is enslaved pethX
+#
+# So if...
+#
+# - User asks for xenbrX
+# - AND xenbrX doesn't exist
+# - AND there is a ethX device which is a bridge
+#
+# ..then we translate xenbrX to ethX
+#
+# This lets old config files work without modification
+#
+if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
+then
+ if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
+ then
+ bridge="eth${bridge#xenbr}"
+ fi
+fi
+
ifconfig $1 0.0.0.0 up
-brctl addif $2 $1
+brctl addif $bridge $1