Skip to content

Commit

Permalink
arp: always override existing neigh entries with gratuitous ARP
Browse files Browse the repository at this point in the history
Currently, when arp_accept is 1, we always override existing neigh
entries with incoming gratuitous ARP replies. Otherwise, we override
them only if new replies satisfy _locktime_ conditional (packets arrive
not earlier than _locktime_ seconds since the last update to the neigh
entry).

The idea behind locktime is to pick the very first (=> close) reply
received in a unicast burst when ARP proxies are used. This helps to
avoid ARP thrashing where Linux would switch back and forth from one
proxy to another.

This logic has nothing to do with gratuitous ARP replies that are
generally not aligned in time when multiple IP address carriers send
them into network.

This patch enforces overriding of existing neigh entries by all incoming
gratuitous ARP packets, irrespective of their time of arrival. This will
make the kernel honour all incoming gratuitous ARP packets.

Signed-off-by: Ihar Hrachyshka <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
booxter authored and davem330 committed May 21, 2017
1 parent d9ef2e7 commit 7d472a5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,16 +863,17 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)

n = __neigh_lookup(&arp_tbl, &sip, dev, 0);

if (IN_DEV_ARP_ACCEPT(in_dev)) {
if (n || IN_DEV_ARP_ACCEPT(in_dev)) {
addr_type = -1;
is_garp = arp_is_garp(net, dev, &addr_type, arp->ar_op,
sip, tip, sha, tha);
}

if (IN_DEV_ARP_ACCEPT(in_dev)) {
/* Unsolicited ARP is not accepted by default.
It is possible, that this option should be enabled for some
devices (strip is candidate)
*/
is_garp = arp_is_garp(net, dev, &addr_type, arp->ar_op,
sip, tip, sha, tha);

if (!n &&
(is_garp ||
(arp->ar_op == htons(ARPOP_REPLY) &&
Expand Down

0 comments on commit 7d472a5

Please sign in to comment.