linux-sg2042/drivers/net/bonding
Jarod Wilson a9b8a2b39c bonding: fix arp_validate toggling in active-backup mode
There's currently a problem with toggling arp_validate on and off with an
active-backup bond. At the moment, you can start up a bond, like so:

modprobe bonding mode=1 arp_interval=100 arp_validate=0 arp_ip_targets=192.168.1.1
ip link set bond0 down
echo "ens4f0" > /sys/class/net/bond0/bonding/slaves
echo "ens4f1" > /sys/class/net/bond0/bonding/slaves
ip link set bond0 up
ip addr add 192.168.1.2/24 dev bond0

Pings to 192.168.1.1 work just fine. Now turn on arp_validate:

echo 1 > /sys/class/net/bond0/bonding/arp_validate

Pings to 192.168.1.1 continue to work just fine. Now when you go to turn
arp_validate off again, the link falls flat on it's face:

echo 0 > /sys/class/net/bond0/bonding/arp_validate
dmesg
...
[133191.911987] bond0: Setting arp_validate to none (0)
[133194.257793] bond0: bond_should_notify_peers: slave ens4f0
[133194.258031] bond0: link status definitely down for interface ens4f0, disabling it
[133194.259000] bond0: making interface ens4f1 the new active one
[133197.330130] bond0: link status definitely down for interface ens4f1, disabling it
[133197.331191] bond0: now running without any active interface!

The problem lies in bond_options.c, where passing in arp_validate=0
results in bond->recv_probe getting set to NULL. This flies directly in
the face of commit 3fe68df97c, which says we need to set recv_probe =
bond_arp_recv, even if we're not using arp_validate. Said commit fixed
this in bond_option_arp_interval_set, but missed that we can get to that
same state in bond_option_arp_validate_set as well.

One solution would be to universally set recv_probe = bond_arp_recv here
as well, but I don't think bond_option_arp_validate_set has any business
touching recv_probe at all, and that should be left to the arp_interval
code, so we can just make things much tidier here.

Fixes: 3fe68df97c ("bonding: always set recv_probe to bond_arp_rcv in arp monitor")
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-13 09:43:46 -07:00
..
Makefile bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00
bond_3ad.c bonding: count master 3ad stats separately 2019-01-24 22:18:48 -08:00
bond_alb.c net: dev: Add extack argument to dev_set_mac_address() 2018-12-13 18:41:38 -08:00
bond_debugfs.c bonding: convert to DEFINE_SHOW_ATTRIBUTE 2018-12-10 12:05:20 -08:00
bond_main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-04-17 11:26:25 -07:00
bond_netlink.c netlink: make nla_nest_start() add NLA_F_NESTED flag 2019-04-27 17:03:44 -04:00
bond_options.c bonding: fix arp_validate toggling in active-backup mode 2019-05-13 09:43:46 -07:00
bond_procfs.c bonding: switch to proc_create_seq_data 2018-05-16 07:24:30 +02:00
bond_sysfs.c bonding: don't cast const buf in sysfs store 2018-07-22 10:09:30 -07:00
bond_sysfs_slave.c bonding: show full hw address in sysfs for slave entries 2019-03-29 13:32:39 -07:00
bonding_priv.h net/bonding: Make DRV macros private 2015-04-26 22:59:53 -04:00