72 lines
1.9 KiB
Diff
72 lines
1.9 KiB
Diff
Index: xen-3.2.1-testing/tools/examples/network-bridge
|
|
===================================================================
|
|
--- xen-3.2.1-testing.orig/tools/examples/network-bridge
|
|
+++ xen-3.2.1-testing/tools/examples/network-bridge
|
|
@@ -180,6 +180,28 @@ antispoofing () {
|
|
iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT
|
|
}
|
|
|
|
+find_active_vlans() {
|
|
+ local netdev=$1
|
|
+ local vlan
|
|
+ local vlans
|
|
+ vlans=""
|
|
+ for vifcfg in /etc/sysconfig/network/ifcfg-vlan* ; do
|
|
+ vlan=${vifcfg/*\/ifcfg-}
|
|
+ if [ "$vlan" = "vlan*" ]; then
|
|
+ continue
|
|
+ fi
|
|
+ . $vifcfg
|
|
+ etherdevice="$ETHERDEVICE"
|
|
+ if [ -x /sbin/getcfg-interface ]; then
|
|
+ etherdevice=$(/sbin/getcfg-interface "$ETHERDEVICE")
|
|
+ fi
|
|
+ if [ "$ETHERDEVICE" = "$netdev" ] || [ "$etherdevice" = "$netdev" ] ; then
|
|
+ link_exists "$vlan" && vlans="$vlans $vlan"
|
|
+ fi
|
|
+ done
|
|
+ echo "$vlans"
|
|
+}
|
|
+
|
|
# Usage: show_status dev bridge
|
|
# Print ifconfig and routes.
|
|
show_status () {
|
|
@@ -208,6 +230,9 @@ op_start () {
|
|
return
|
|
fi
|
|
|
|
+ vlans=$(find_active_vlans "${netdev}")
|
|
+ for vlan in $vlans ; do ifdown $vlan ; done
|
|
+
|
|
create_bridge ${tdev}
|
|
|
|
preiftransfer ${netdev}
|
|
@@ -226,6 +251,8 @@ op_start () {
|
|
add_to_bridge2 ${bridge} ${pdev}
|
|
do_ifup ${bridge}
|
|
|
|
+ for vlan in $vlans ; do ifup $vlan ; done
|
|
+
|
|
if [ ${antispoof} = 'yes' ] ; then
|
|
antispoofing
|
|
fi
|
|
@@ -239,6 +266,9 @@ op_stop () {
|
|
return
|
|
fi
|
|
|
|
+ vlans=$(find_active_vlans "${netdev}")
|
|
+ for vlan in $vlans ; do ifdown $vlan ; done
|
|
+
|
|
transfer_addrs ${bridge} ${pdev}
|
|
if ! ifdown ${bridge}; then
|
|
get_ip_info ${bridge}
|
|
@@ -254,6 +284,8 @@ op_stop () {
|
|
ip link set ${pdev} down
|
|
ip link set ${pdev} name ${netdev}
|
|
do_ifup ${netdev}
|
|
+
|
|
+ for vlan in $vlans ; do ifup $vlan ; done
|
|
}
|
|
|
|
# adds $dev to $bridge but waits for $dev to be in running state first
|