linux/drivers/net
dingtianhong 495d9de1ad 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>
[bwh: Backported to 3.10: bond_for_each_slave() takes an extra int paramter]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-22 14:37:53 -07:00
..
appletalk appletalk: remove "config IPDDP_DECAP" 2013-03-22 10:21:09 -04:00
arcnet arcnet: cleanup sizeof parameter 2013-08-11 18:35:25 -07:00
bonding bonding: correct the MAC address for "follow" fail_over_mac policy 2015-10-22 14:37:53 -07:00
caif caif: CAIF_VIRTIO should depend on HAS_DMA 2013-05-11 16:28:24 -07:00
can can: add missing initialisations in CAN related skbuffs 2015-03-26 15:00:58 +01:00
cris
dsa
ethernet tg3: Fix temperature reporting 2015-10-01 12:07:28 +02:00
fddi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
hamradio hamradio/yam: fix info leak in ioctl 2014-01-15 15:28:48 -08:00
hippi rrunner.c: fix possible memory leak in rr_init_one() 2013-03-10 16:42:23 -04:00
hyperv hyperv: Fix a bug in netvsc_start_xmit() 2014-10-15 08:31:57 +02:00
ieee802154 ieee802154: fix error handling in ieee802154fake_probe() 2014-12-06 15:05:46 -08:00
irda net/irda: fix error return code in bfin_sir_open() 2013-05-08 13:13:29 -07:00
phy net: dp83640: fix broken calibration routine. 2015-06-22 16:55:51 -07:00
plip net: add ETH_P_802_3_MIN 2013-03-28 01:20:42 -04:00
ppp ppp: deflate: never return len larger than output buffer 2015-02-26 17:48:48 -08:00
slip
team team: don't traverse port list using rcu in team_set_mac_address 2015-03-18 13:22:27 +01:00
usb usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared 2015-10-01 12:07:37 +02:00
vmxnet3 vmxnet3: fix building without CONFIG_PCI_MSI 2014-03-23 21:38:18 -07:00
wan wanxl: fix info leak in ioctl 2013-11-04 04:31:04 -08:00
wimax
wireless rtlwifi: rtl8192cu: Add new device ID 2015-10-01 12:07:28 +02:00
xen-netback xen: netback: read hotplug script once at start of day. 2015-06-22 16:55:51 -07:00
dummy.c dummy: fix oops when loading the dummy failed 2013-07-28 16:30:01 -07:00
eql.c
ifb.c ifb: fix oops when loading the ifb failed 2013-07-28 16:30:01 -07:00
Kconfig drivers/net: macvtap and tun depend on INET 2014-11-14 08:47:53 -08:00
LICENSE.SRC
loopback.c
macvlan.c macvlan: Initialize vlan_features to turn on offload support. 2014-08-14 09:24:15 +08:00
macvtap.c macvtap: make sure neighbour code can push ethernet header 2015-03-18 13:22:27 +01:00
Makefile
mdio.c
mii.c
netconsole.c netconsole: don't call __netpoll_cleanup() while atomic 2013-03-12 06:58:55 -04:00
ntb_netdev.c ntb_netdev: remove from list on exit 2013-05-15 10:58:14 -07:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tun.c tun: update file current position 2014-01-15 15:28:46 -08:00
veth.c net: vlan: announce STAG offload capability in some drivers 2013-04-19 14:46:06 -04:00
virtio_net.c virtio-net: alloc big buffers also when guest can receive UFO 2014-03-23 21:38:10 -07:00
vxlan.c inetpeer: get rid of ip_id_count 2014-08-14 09:24:15 +08:00
xen-netfront.c xen-netfront: Remove BUGs on paged skb data which crosses a page boundary 2014-12-16 09:09:42 -08:00