linux/drivers/net/bonding
dingtianhong 13e4ceb7c4 bonding: correct the MAC address for "follow" fail_over_mac policy
[ Upstream commit a951bc1e6b ]

The "follow" fail_over_mac policy is useful for multiport devices that
either become confused or incur a performance penalty when multiple
ports are programmed with the same MAC address, but the same MAC
address still may happened by this steps for this policy:

1) echo +eth0 > /sys/class/net/bond0/bonding/slaves
   bond0 has the same mac address with eth0, it is MAC1.

2) echo +eth1 > /sys/class/net/bond0/bonding/slaves
   eth1 is backup, eth1 has MAC2.

3) ifconfig eth0 down
   eth1 became active slave, bond will swap MAC for eth0 and eth1,
   so eth1 has MAC1, and eth0 has MAC2.

4) ifconfig eth1 down
   there is no active slave, and eth1 still has MAC1, eth2 has MAC2.

5) ifconfig eth0 up
   the eth0 became active slave again, the bond set eth0 to MAC1.

Something wrong here, then if you set eth1 up, the eth0 and eth1 will have the same
MAC address, it will break this policy for ACTIVE_BACKUP mode.

This patch will fix this problem by finding the old active slave and
swap them MAC address before change active slave.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Tested-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
History 2015-09-28 18:57:01 -04:00
..
bond_3ad.c bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
bond_3ad.h bonding: 3ad: convert to bond->mode_lock 2014-09-13 16:29:07 -04:00
bond_alb.c vlan: kill vlan_put_tag helper 2015-04-27 16:48:33 -04:00
bond_alb.h bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
bond_debugfs.c bonding: trivial: style and comment fixes 2014-09-15 17:19:49 -04:00
bond_main.c bonding: correct the MAC address for "follow" fail_over_mac policy 2015-09-28 18:57:01 -04:00
bond_netlink.c bond: Check length of IFLA_BOND_ARP_IP_TARGET attributes 2014-11-29 20:46:32 -08:00
bond_options.c rtnl/bond: don't send rtnl msg for unregistered iface 2015-06-15 14:26:49 -04:00
bond_options.h bonding: make a generic sysfs option store and fix comments 2014-05-09 16:12:51 -04:00
bond_procfs.c bonding: display xmit_hash_policy for non-dynamic-tlb mode 2014-10-06 17:13:07 -04:00
bond_sysfs.c bonding: trivial: style and comment fixes 2014-09-15 17:19:49 -04:00
bond_sysfs_slave.c treewide: Fix typo in printk 2014-08-26 09:35:54 +02:00
bonding.h bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
Makefile bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00