Skip to contentSkip to conversation

Change tap device mac address to prevent change of bridge's mac

PATCH In review Miroslav Rezanina 3 participants 3 messages Dec 21, 2010 – Jan 5, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1238106651.28663.1292935027329.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com

#1 lore raw

PATCH 1/1 Change tap device mac address to prevent change of bridge's mac

Qemu tap device is created with random mac address and then add to bridge. Due to linux kernel handlig, bridge change its mac address to tap mac in case tap mac is lower than bridge one. This can lead to short network breakage for dom0 and guests.

This patch set tap device mac adress to FE:FF:FF:FF:FF:FF to ensure tap device mac is always higher then bridge one.

Patch:
--

i386-dm/qemu-ifup-Linux +3 -0
index bcbee92..c706a10 100644
@@ -33,5 +33,8 @@ then
    fi
 fi
 
+# We have to change mac address of tap device to not change bridge mac
+ip link set $1 addr fe:ff:ff:ff:ff:ff
+
 ifconfig $1 0.0.0.0 up
 brctl addif $bridge $1 || true
Signature · 2 lines
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel
#2 lore raw
Quoted 5 lines · Miroslav Rezanina

Qemu tap device is created with random mac address and then add to bridge. Due to linux kernel handlig, bridge change its mac address to tap mac in case tap mac is lower than bridge one. This can lead to short network breakage for dom0 and guests.

This patch set tap device mac adress to FE:FF:FF:FF:FF:FF to ensure tap device mac is always higher then bridge one.

Thanks. This needed a different fix in xen-unstable.hg because tap devices are handled by the hotplug scripts and not qemu-ifup there. See the recent thread "tools/hotplug/Linux: Ensure tap devices receive a dummy MAC address".

My backport to xen-4.0-testing looked a lot like yours.

Ian.

Quoted 16 lines

Patch:
--

i386-dm/qemu-ifup-Linux +3 -0
index bcbee92..c706a10 100644
@@ -33,5 +33,8 @@ then
    fi
 fi
 
+# We have to change mac address of tap device to not change bridge mac
+ip link set $1 addr fe:ff:ff:ff:ff:ff
+
 ifconfig $1 0.0.0.0 up
 brctl addif $bridge $1 || true
#3 lore raw

Ian Campbell writes ("Re: [Xen-devel] [PATCH][qemu-xen] Change tap device mac address to prevent change of bridge's mac"):

Quoted 5 lines · Miroslav Rezanina
Quoted 4 lines

Qemu tap device is created with random mac address and then add to bridge. Due to linux kernel handlig, bridge change its mac address to tap mac in case tap mac is lower than bridge one. This can lead to short network breakage for dom0 and guests.

This patch set tap device mac adress to FE:FF:FF:FF:FF:FF to ensure tap device mac is always higher then bridge one.

Quoted 8 lines
Quoted 1 line

Thanks. This needed a different fix in xen-unstable.hg because tap devices are handled by the hotplug scripts and not qemu-ifup there. See the recent thread "tools/hotplug/Linux: Ensure tap devices receive a dummy MAC address".

My backport to xen-4.0-testing looked a lot like yours.

Thanks for that, I've applied Miroslav's patch to
qemu-xen-4.0-testing.git.

Ian.