Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d955180 authored by Octavian Purdila's avatar Octavian Purdila Committed by David S. Miller
Browse files

ipv4: allow warming up the ARP cache with request type gratuitous ARP



If the per device ARP_ACCEPT option is enable, currently we only allow
creating new ARP cache entries for response type gratuitous ARP.

Allowing gratuitous ARP to create new ARP entries (not only to update
existing ones) is useful when we want to avoid unnecessary delays for
the first packet of a stream.

This patch allows request type gratuitous ARP to create new ARP cache
entries as well. This is useful when we want to populate the ARP cache
entries for a large number of hosts on the same LAN.

Signed-off-by: default avatarOctavian Purdila <opurdila@ixiacom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa44a73c
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -852,9 +852,18 @@ arp_notify - BOOLEAN
	    or hardware address changes.
	    or hardware address changes.


arp_accept - BOOLEAN
arp_accept - BOOLEAN
	Define behavior when gratuitous arp replies are received:
	Define behavior for gratuitous ARP frames who's IP is not
	0 - drop gratuitous arp frames
	already present in the ARP table:
	1 - accept gratuitous arp frames
	0 - don't create new entries in the ARP table
	1 - create new entries in the ARP table

	Both replies and requests type gratuitous arp will trigger the
	ARP table to be updated, if this setting is on.

	If the ARP table already contains the IP address of the
	gratuitous arp frame, the arp table will be updated regardless
	if this setting is on or off.



app_solicit - INTEGER
app_solicit - INTEGER
	The maximum number of probes to send to the user space ARP daemon
	The maximum number of probes to send to the user space ARP daemon
+2 −1
Original line number Original line Diff line number Diff line
@@ -907,7 +907,8 @@ static int arp_process(struct sk_buff *skb)
		   devices (strip is candidate)
		   devices (strip is candidate)
		 */
		 */
		if (n == NULL &&
		if (n == NULL &&
		    arp->ar_op == htons(ARPOP_REPLY) &&
		    (arp->ar_op == htons(ARPOP_REPLY) ||
		     (arp->ar_op == htons(ARPOP_REQUEST) && tip == sip)) &&
		    inet_addr_type(net, sip) == RTN_UNICAST)
		    inet_addr_type(net, sip) == RTN_UNICAST)
			n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
			n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
	}
	}