2012-09-17 17:49:23 +02:00
|
|
|
Index: xen-4.2.0-testing/tools/hotplug/Linux/network-bridge
|
2007-08-12 11:48:30 +02:00
|
|
|
===================================================================
|
2012-09-17 17:49:23 +02:00
|
|
|
--- xen-4.2.0-testing.orig/tools/hotplug/Linux/network-bridge
|
|
|
|
+++ xen-4.2.0-testing/tools/hotplug/Linux/network-bridge
|
|
|
|
@@ -195,6 +195,28 @@ antispoofing () {
|
2008-04-12 21:41:18 +02:00
|
|
|
iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT
|
2007-08-12 11:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
2008-04-12 21:41:18 +02:00
|
|
|
+ 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"
|
2007-08-12 11:48:30 +02:00
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+ echo "$vlans"
|
|
|
|
+}
|
|
|
|
+
|
2008-04-12 21:41:18 +02:00
|
|
|
# Usage: show_status dev bridge
|
|
|
|
# Print ifconfig and routes.
|
|
|
|
show_status () {
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -229,6 +251,9 @@ op_start () {
|
2010-03-21 11:57:55 +01:00
|
|
|
|
|
|
|
claim_lock "network-bridge"
|
2008-04-12 21:41:18 +02:00
|
|
|
|
|
|
|
+ vlans=$(find_active_vlans "${netdev}")
|
|
|
|
+ for vlan in $vlans ; do ifdown $vlan ; done
|
|
|
|
+
|
|
|
|
create_bridge ${tdev}
|
|
|
|
|
|
|
|
preiftransfer ${netdev}
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -256,6 +281,8 @@ op_start () {
|
2008-04-12 21:41:18 +02:00
|
|
|
add_to_bridge2 ${bridge} ${pdev}
|
|
|
|
do_ifup ${bridge}
|
|
|
|
|
|
|
|
+ for vlan in $vlans ; do ifup $vlan ; done
|
|
|
|
+
|
|
|
|
if [ ${antispoof} = 'yes' ] ; then
|
|
|
|
antispoofing
|
|
|
|
fi
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -277,6 +304,9 @@ op_stop () {
|
2010-03-21 11:57:55 +01:00
|
|
|
|
|
|
|
claim_lock "network-bridge"
|
2008-04-12 21:41:18 +02:00
|
|
|
|
|
|
|
+ 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}
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -293,6 +323,8 @@ op_stop () {
|
2008-05-24 00:00:43 +02:00
|
|
|
ip link set ${pdev} name ${netdev}
|
2008-04-12 21:41:18 +02:00
|
|
|
do_ifup ${netdev}
|
2010-03-21 11:57:55 +01:00
|
|
|
|
2010-03-21 11:57:54 +01:00
|
|
|
+ for vlan in $vlans ; do ifup $vlan ; done
|
2010-03-21 11:57:55 +01:00
|
|
|
+
|
|
|
|
release_lock "network-bridge"
|
2008-04-12 21:41:18 +02:00
|
|
|
}
|
|
|
|
|