Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 8dc006009caeee49bf7265b32a566d99 > files > 14

xen-3.2.0-6.1mdv2008.1.i586.rpm

#!/bin/sh

#. /etc/rc.d/init.d/functions
#ulimit -c unlimited

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 $bridge $1 || true