[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/hotplug/Linux: Ensure tap devices receive a dummy MAC address



On Tue, 2011-01-04 at 09:35 +0000, Ian Campbell wrote:
> On Sat, 2010-12-25 at 00:17 +0000, John Weekes wrote:
> > Ian,
> > 
> > This appears to have the side effect on dom0 of also causing both eth0 
> > and peth0 to have MAC fe:ff:ff:ff:ff:ff. I had to revert it to make 
> > networking work properly again for me.
> 
> That's unexpected, to say the least! I'll take a look. Thanks for
> reporting.
> 
> Are you using xend or xl?
> 
> Do you rely on the network-bridge script to setup your host networking
> (the xend way) or are you using the distro network configuration (the xl
> way).

Nevermind, I reproduced with xend+network-bridge. This fixes it for me:

(BTW these days we would recommend that instead of relying on xend to
configure your bridges that you use the distro network configuration
facilities instead)

8<-----------------------------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1294136795 0
# Node ID d6a80e856d5bdb44d884adead46d1ed1556c1fe6
# Parent  8418dfcad441483000cc3965edf3ff090c9b3583
tools/hotplug/Linux: only apply dummy MAC address to virtual devices.

Avoid applying to the bridge and physical network device.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 8418dfcad441 -r d6a80e856d5b tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge        Tue Jan 04 09:52:53 2011 +0000
+++ b/tools/hotplug/Linux/network-bridge        Tue Jan 04 10:26:35 2011 +0000
@@ -244,7 +244,7 @@ op_start () {
     ip link set ${netdev} name ${pdev}
     ip link set ${tdev} name ${bridge}
 
-    setup_bridge_port ${pdev}
+    setup_physical_bridge_port ${pdev}
 
     # Restore slaves
     if [ -n "${slaves}" ]; then
diff -r 8418dfcad441 -r d6a80e856d5b tools/hotplug/Linux/vif-bridge
--- a/tools/hotplug/Linux/vif-bridge    Tue Jan 04 09:52:53 2011 +0000
+++ b/tools/hotplug/Linux/vif-bridge    Tue Jan 04 10:26:35 2011 +0000
@@ -81,7 +81,7 @@ fi
 
 case "$command" in
     online)
-        setup_bridge_port "$dev"
+        setup_virtual_bridge_port "$dev"
         add_to_bridge "$bridge" "$dev"
         ;;
 
@@ -91,7 +91,7 @@ case "$command" in
         ;;
 
     add)
-        setup_bridge_port "$dev"
+        setup_virtual_bridge_port "$dev"
         add_to_bridge "$bridge" "$dev"
         ;;
 esac
diff -r 8418dfcad441 -r d6a80e856d5b tools/hotplug/Linux/vif2
--- a/tools/hotplug/Linux/vif2  Tue Jan 04 09:52:53 2011 +0000
+++ b/tools/hotplug/Linux/vif2  Tue Jan 04 10:26:35 2011 +0000
@@ -23,7 +23,7 @@ case "$command" in
     "online")
        if [ "$bridge" != "-" ]
            then
-           setup_bridge_port "$vif"
+           setup_virtual_bridge_port "$vif"
            add_to_bridge "$bridge" "$vif"
        else
            # Just let the normal udev rules for interfaces handle it.
diff -r 8418dfcad441 -r d6a80e856d5b tools/hotplug/Linux/xen-network-common.sh
--- a/tools/hotplug/Linux/xen-network-common.sh Tue Jan 04 09:52:53 2011 +0000
+++ b/tools/hotplug/Linux/xen-network-common.sh Tue Jan 04 10:26:35 2011 +0000
@@ -80,20 +80,30 @@ find_dhcpd_arg_file()
 }
 
 # configure interfaces which act as pure bridge ports:
-setup_bridge_port() {
+_setup_bridge_port() {
     local dev="$1"
+    local virtual="$2"
 
     # take interface down ...
     ip link set ${dev} down
 
-    # Initialise a dummy MAC address. We choose the numerically
-    # largest non-broadcast address to prevent the address getting
-    # stolen by an Ethernet bridge for STP purposes.
-    # (FE:FF:FF:FF:FF:FF)
-    ip link set ${dev} address fe:ff:ff:ff:ff:ff || true
+    if [ $virtual -ne 0 ] ; then
+        # Initialise a dummy MAC address. We choose the numerically
+        # largest non-broadcast address to prevent the address getting
+        # stolen by an Ethernet bridge for STP purposes.
+        # (FE:FF:FF:FF:FF:FF)
+        ip link set ${dev} address fe:ff:ff:ff:ff:ff || true
+    fi
 
     # ... and configure it
     ip addr flush ${dev}
+}
+
+setup_physical_bridge_port() {
+    _setup_bridge_port $1 0
+}
+setup_virtual_bridge_port() {
+    _setup_bridge_port $1 1
 }
 
 # Usage: create_bridge bridge



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.