@@ -76,10 +76,17 @@ function teardown_primary()
function setup_secondary()
{
- do_without_error brctl delif $bridge $vifname
- do_without_error brctl addbr $forwardbr
- do_without_error brctl addif $forwardbr $vifname
- do_without_error brctl addif $forwardbr $forwarddev
+ if [ -x "/usr/sbin/brctl" ]; then
+ do_without_error brctl delif $bridge $vifname
+ do_without_error brctl addbr $forwardbr
+ do_without_error brctl addif $forwardbr $vifname
+ do_without_error brctl addif $forwardbr $forwarddev
+ else
+ do_without_error ip link set $vifname nomaster
+ do_without_error ip link add name $forwardbr type bridge
+ do_without_error ip link set $vifname master $forwardbr
+ do_without_error ip link set $forwarddev master $forwardbr
+ fi
do_without_error ip link set dev $forwardbr up
do_without_error modprobe xt_SECCOLO
@@ -91,10 +98,17 @@ function setup_secondary()
function teardown_secondary()
{
- do_without_error brctl delif $forwardbr $forwarddev
- do_without_error brctl delif $forwardbr $vifname
- do_without_error brctl delbr $forwardbr
- do_without_error brctl addif $bridge $vifname
+ if [ -x "/usr/sbin/brctl" ]; then
+ do_without_error brctl delif $forwardbr $forwarddev
+ do_without_error brctl delif $forwardbr $vifname
+ do_without_error brctl delbr $forwardbr
+ do_without_error brctl addif $bridge $vifname
+ else
+ do_without_error ip link set $forwarddev nomaster
+ do_without_error ip link set $vifname nomaster
+ do_without_error ip link delete $forwardbr type bridge
+ do_without_error ip link set $vifname master $bridge
+ fi
do_without_error iptables -t mangle -D PREROUTING -m physdev --physdev-in \
$vifname -j SECCOLO --index $index
@@ -31,12 +31,13 @@ dir=$(dirname "$0")
bridge=${bridge:-}
bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
-if [ -z "$bridge" ]
-then
- bridge=$(brctl show | awk 'NR==2{print$1}')
-
- if [ -z "$bridge" ]
- then
+if [ -z "$bridge" ]; then
+ if [ -x "/usr/sbin/brctl" ]; then
+ bridge=$(brctl show | awk 'NR==2{print$1}')
+ else
+ bridge=$(bridge link | cut -d" " -f7)
+ fi
+ if [ -z "$bridge" ]; then
fatal "Could not find bridge, and none was specified"
fi
else
@@ -82,7 +83,11 @@ case "$command" in
;;
offline)
- do_without_error brctl delif "$bridge" "$dev"
+ if [ -x "/usr/sbin/brctl"]; then
+ do_without_error brctl delif "$bridge" "$dev"
+ else
+ do_without_error ip link set "$dev" nomaster
+ fi
do_without_error ifconfig "$dev" down
;;
@@ -7,13 +7,21 @@ dir=$(dirname "$0")
bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
if [ -z "$bridge" ]
then
- nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1))
+ if [ -x "/usr/sbin/brctl" ]; then
+ nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1))
+ else
+ nr_bridges=$(bridge link | wc -l)
+ fi
if [ "$nr_bridges" != 1 ]
then
fatal "no bridge specified, and don't know which one to use ($nr_bridges found)"
fi
- bridge=$(brctl show | cut -d "
+ if [ -x "/usr/sbin/brctl" ]; then
+ bridge=$(brctl show | cut -d "
" -f 2 | cut -f 1)
+ else
+ bridge=$(bridge link | cut -d" " -f6)
+ fi
fi
command="$1"
@@ -108,9 +108,12 @@ create_bridge () {
# Don't create the bridge if it already exists.
if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then
- brctl addbr ${bridge}
- brctl stp ${bridge} off
- brctl setfd ${bridge} 0
+ if [ -x "/usr/sbin/brctl" ]; then
+ brctl addbr ${bridge}
+ brctl stp ${bridge} off
+ brctl setfd ${bridge} 0
+ else
+ ip link add name ${bridge} type bridge stp_state 0 forward_delay 0
fi
}
@@ -124,7 +127,11 @@ add_to_bridge () {
ip link set dev ${dev} up || true
return
fi
- brctl addif ${bridge} ${dev}
+ if [ -x "/usr/sbin/brctl" ]; then
+ brctl addif ${bridge} ${dev}
+ else
+ ip link set ${dev} master ${bridge}
+ fi
ip link set dev ${dev} up
}
Signed-off-by: Steven Haigh <netwiz@crc.id.au> --- tools/hotplug/Linux/colo-proxy-setup | 30 +++++++++++++++++------ tools/hotplug/Linux/vif-bridge | 19 ++++++++------ tools/hotplug/Linux/vif2 | 12 +++++++-- tools/hotplug/Linux/xen-network-common.sh | 15 +++++++++--- 4 files changed, 55 insertions(+), 21 deletions(-)