aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>2005-08-13 22:04:22 +0000
committeriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>2005-08-13 22:04:22 +0000
commita13b3d07c70c55bf706007509a69cc92acb1a07e (patch)
treeafb8842a197573b9c78d8155d028779dff2c1fb8
parentcb9d509d6a3ea6dc399174ad8d6477b9debfce56 (diff)
parent141ec0c6391b4d5d38dbb66369cea38373d0b7df (diff)
downloadxen-a13b3d07c70c55bf706007509a69cc92acb1a07e.tar.gz
xen-a13b3d07c70c55bf706007509a69cc92acb1a07e.tar.bz2
xen-a13b3d07c70c55bf706007509a69cc92acb1a07e.zip
merge...
-rwxr-xr-xtools/examples/network-bridge (renamed from tools/examples/network)50
-rw-r--r--tools/examples/xend-config.sxp2
2 files changed, 33 insertions, 19 deletions
diff --git a/tools/examples/network b/tools/examples/network-bridge
index 537bbe3dab..d9fc2d855f 100755
--- a/tools/examples/network
+++ b/tools/examples/network-bridge
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -x
#============================================================================
# Default Xen network start/stop script.
# Xend calls a network script when it starts.
@@ -176,26 +176,40 @@ op_start () {
fi
if ifconfig veth0 2>/dev/null | grep -q veth0 ; then
- # Propagate MAC address and ARP responsibilities to virtual interface.
- mac=`ifconfig ${netdev} | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'`
- ifconfig veth0 down
- ifconfig veth0 hw ether ${mac}
- ifconfig veth0 arp up
- transfer_addrs ${netdev} veth0
- transfer_routes ${netdev} veth0
- del_addrs ${netdev}
- ifconfig ${netdev} -arp down
- ifconfig ${netdev} hw ether fe:ff:ff:ff:ff:ff up
- # Bring up second half of virtual device and attach it to the bridge.
- ifconfig vif0.0 up
- add_to_bridge ${bridge} vif0.0
+ mac=`ifconfig ${netdev} | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'`
+ if ! ifdown ${netdev} ; then
+ # if ifup didn't work, see if we have an ip= on cmd line
+ if egrep 'ip=[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:' /proc/cmdline ;
+ then
+ kip=`sed -e 's!.*ip=\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\):.*!\1!' /proc/cmdline`
+ kmask=`sed -e 's!.*ip=[^:]*:[^:]*:[^:]*:\([^:]*\):.*!\1!' /proc/cmdline`
+ kgate=`sed -e 's!.*ip=[^:]*:[^:]*:\([^:]*\):.*!\1!' /proc/cmdline`
+ ifconfig ${netdev} 0.0.0.0 down
+ fi
+ fi
+ ip link set ${netdev} name p${netdev}
+ ip link set veth0 name eth0
+ ifconfig p${netdev} -arp down
+ ifconfig p${netdev} hw ether fe:ff:ff:ff:ff:ff
+ ifconfig ${netdev} hw ether ${mac}
+ add_to_bridge ${bridge} vif0.0
+ add_to_bridge ${bridge} p${netdev}
+ ip link set vif0.0 up
+ ip link set p${netdev} up
+ if ! ifup ${netdev} ; then
+ if [ ${kip} ] ; then
+ # use the addresses we grocked from /proc/cmdline
+ ifconfig ${netdev} ${kip}
+ [ ${kmask} ] && ifconfig ${netdev} netmask ${kmask}
+ ifconfig ${netdev} up
+ [ ${kgate} ] && ip route add default via ${kgate}
+ fi
+ fi
else
- transfer_addrs ${netdev} ${bridge}
+ # old style without veth0
+ transfer_addrs ${netdev} ${bridge}
transfer_routes ${netdev} ${bridge}
fi
-
- # Attach the real interface to the bridge.
- add_to_bridge ${bridge} ${netdev}
if [ ${antispoof} == 'yes' ] ; then
antispoofing ${netdev} ${bridge}
diff --git a/tools/examples/xend-config.sxp b/tools/examples/xend-config.sxp
index d8914d320d..249cdce507 100644
--- a/tools/examples/xend-config.sxp
+++ b/tools/examples/xend-config.sxp
@@ -28,7 +28,7 @@
## Use the following if VIF traffic is bridged.
# The script used to start/stop networking for xend.
-(network-script network)
+(network-script network-bridge)
# The default bridge that virtual interfaces should be connected to.
(vif-bridge xen-br0)
# The default script used to control virtual interfaces.