1 From foo@baz Wed 15 May 2019 07:51:30 AM CEST
2 From: Jarod Wilson <jarod@redhat.com>
3 Date: Fri, 10 May 2019 17:57:09 -0400
4 Subject: bonding: fix arp_validate toggling in active-backup mode
6 From: Jarod Wilson <jarod@redhat.com>
8 [ Upstream commit a9b8a2b39ce65df45687cf9ef648885c2a99fe75 ]
10 There's currently a problem with toggling arp_validate on and off with an
11 active-backup bond. At the moment, you can start up a bond, like so:
13 modprobe bonding mode=1 arp_interval=100 arp_validate=0 arp_ip_targets=192.168.1.1
14 ip link set bond0 down
15 echo "ens4f0" > /sys/class/net/bond0/bonding/slaves
16 echo "ens4f1" > /sys/class/net/bond0/bonding/slaves
18 ip addr add 192.168.1.2/24 dev bond0
20 Pings to 192.168.1.1 work just fine. Now turn on arp_validate:
22 echo 1 > /sys/class/net/bond0/bonding/arp_validate
24 Pings to 192.168.1.1 continue to work just fine. Now when you go to turn
25 arp_validate off again, the link falls flat on it's face:
27 echo 0 > /sys/class/net/bond0/bonding/arp_validate
30 [133191.911987] bond0: Setting arp_validate to none (0)
31 [133194.257793] bond0: bond_should_notify_peers: slave ens4f0
32 [133194.258031] bond0: link status definitely down for interface ens4f0, disabling it
33 [133194.259000] bond0: making interface ens4f1 the new active one
34 [133197.330130] bond0: link status definitely down for interface ens4f1, disabling it
35 [133197.331191] bond0: now running without any active interface!
37 The problem lies in bond_options.c, where passing in arp_validate=0
38 results in bond->recv_probe getting set to NULL. This flies directly in
39 the face of commit 3fe68df97c7f, which says we need to set recv_probe =
40 bond_arp_recv, even if we're not using arp_validate. Said commit fixed
41 this in bond_option_arp_interval_set, but missed that we can get to that
42 same state in bond_option_arp_validate_set as well.
44 One solution would be to universally set recv_probe = bond_arp_recv here
45 as well, but I don't think bond_option_arp_validate_set has any business
46 touching recv_probe at all, and that should be left to the arp_interval
47 code, so we can just make things much tidier here.
49 Fixes: 3fe68df97c7f ("bonding: always set recv_probe to bond_arp_rcv in arp monitor")
50 CC: Jay Vosburgh <j.vosburgh@gmail.com>
51 CC: Veaceslav Falico <vfalico@gmail.com>
52 CC: Andy Gospodarek <andy@greyhouse.net>
53 CC: "David S. Miller" <davem@davemloft.net>
54 CC: netdev@vger.kernel.org
55 Signed-off-by: Jarod Wilson <jarod@redhat.com>
56 Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
57 Signed-off-by: David S. Miller <davem@davemloft.net>
58 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
60 drivers/net/bonding/bond_options.c | 7 -------
61 1 file changed, 7 deletions(-)
63 --- a/drivers/net/bonding/bond_options.c
64 +++ b/drivers/net/bonding/bond_options.c
65 @@ -1098,13 +1098,6 @@ static int bond_option_arp_validate_set(
67 netdev_dbg(bond->dev, "Setting arp_validate to %s (%llu)\n",
68 newval->string, newval->value);
70 - if (bond->dev->flags & IFF_UP) {
72 - bond->recv_probe = NULL;
73 - else if (bond->params.arp_interval)
74 - bond->recv_probe = bond_arp_rcv;
76 bond->params.arp_validate = newval->value;