Skip to content

Commit aeea64a

Browse files
Veaceslav Falicodavem330
authored andcommitted
bonding: don't trust arp requests unless active slave really works
Currently, if we receive any arp packet on a backup slave in active-backup mode and arp_validate enabled, we suppose that it's an arp request, swap source/target ip and try to validate it. This optimization gives us virtually no downtime in the most common situation (active and backup slaves are in the same broadcast domain and the active slave failed). However, if we can't reach the arp_ip_target(s), we end up in an endless loop of reselecting slaves, because we receive our arp requests, sent by the active slave, and think that backup slaves are up, thus selecting them as active and, again, sending arp requests, which fool our backup slaves. Fix this by not validating the swapped arp packets if the current active slave didn't receive any arp reply after it was selected as active. This way we will only accept arp requests if we know that the current active slave can actually reach arp_ip_target. v3->v4: Obey 80 lines and make checkpatch.pl happy, per Sergei's suggestion. v1->v3: No change. Signed-off-by: Veaceslav Falico <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2c14610 commit aeea64a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2677,10 +2677,17 @@ static int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
26772677
* configuration, the ARP probe will (hopefully) travel from
26782678
* the active, through one switch, the router, then the other
26792679
* switch before reaching the backup.
2680+
*
2681+
* We 'trust' the arp requests if there is an active slave and
2682+
* it received valid arp reply(s) after it became active. This
2683+
* is done to avoid endless looping when we can't reach the
2684+
* arp_ip_target and fool ourselves with our own arp requests.
26802685
*/
26812686
if (bond_is_active_slave(slave))
26822687
bond_validate_arp(bond, slave, sip, tip);
2683-
else
2688+
else if (bond->curr_active_slave &&
2689+
time_after(slave_last_rx(bond, bond->curr_active_slave),
2690+
bond->curr_active_slave->jiffies))
26842691
bond_validate_arp(bond, slave, tip, sip);
26852692

26862693
out_unlock:

0 commit comments

Comments
 (0)