Commit 7d26bb10 authored by Weiping Pan's avatar Weiping Pan Committed by David S. Miller
Browse files

bonding: emit event when bonding changes MAC

When a bonding device is configured with fail_over_mac=active,
we expect to see the MAC address of the new active slave as the source MAC
address after failover. But we see that the source MAC address is the MAC
address of previous active slave.

Emit NETDEV_CHANGEADDR event when bonding changes its MAC address, in order
to let arp_netdev_event flush neighbour cache and route cache.

How to reproduce this bug ?

hostA ----- switch ---|-- eth0--bond0(|
(  \--|-- eth1-/                       |

1 on hostB,
modprobe bonding mode=1 miimon=500 fail_over_mac=active downdelay=1000
ifconfig bond0 up
ifenslave bond0 eth0
ifenslave bond0 eth1

then eth0 is the active slave, and MAC of bond0 is MAC of eth0.

2 on hostA, ping

3 on hostB,
tcpdump -i bond0 -p icmp -XXX
you will see bond0 uses MAC of eth0 as source MAC in icmp reply.

4 on hostB,
ifconfig eth0 down
tcpdump -i bond0 -p icmp -XXX (just keep it running in step 3)
you will see first bond0 uses MAC of eth1 as source MAC in icmp
reply, then it will use MAC of eth0 as source MAC.

Signed-off-by: default avatarWeiping Pan <>
Signed-off-by: default avatarJay Vosburgh <>
Signed-off-by: default avatarDavid S. Miller <>
parent 3b9785c6
......@@ -892,9 +892,15 @@ static void bond_do_fail_over_mac(struct bonding *bond,
switch (bond->params.fail_over_mac) {
if (new_active)
if (new_active) {
memcpy(bond->dev->dev_addr, new_active->dev->dev_addr,
call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment