netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH v3] ipv4: allow warming up the ARP cache with request type gratuitous ARP
@ 2010-01-18 22:58 Octavian Purdila
  2010-01-18 23:39 ` Mark Smith
  2010-01-19 10:12 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Octavian Purdila @ 2010-01-18 22:58 UTC (permalink / raw)
  To: David Miller; +Cc: Julian Anastasov, Laurent Chavey, netdev

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: Octavian Purdila <opurdila@ixiacom.com>
---
 Documentation/networking/ip-sysctl.txt |   15 ++++++++++++---
 net/ipv4/arp.c                         |    3 ++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index c532884..2dc7a1d 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -852,9 +852,18 @@ arp_notify - BOOLEAN
 	    or hardware address changes.
 
 arp_accept - BOOLEAN
-	Define behavior when gratuitous arp replies are received:
-	0 - drop gratuitous arp frames
-	1 - accept gratuitous arp frames
+	Define behavior for gratuitous ARP frames who's IP is not
+	already present in the ARP table:
+	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
 	The maximum number of probes to send to the user space ARP daemon
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 0787092..1940b4d 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -907,7 +907,8 @@ static int arp_process(struct sk_buff *skb)
 		   devices (strip is candidate)
 		 */
 		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)
 			n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
 	}
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-19 11:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 22:58 [net-next PATCH v3] ipv4: allow warming up the ARP cache with request type gratuitous ARP Octavian Purdila
2010-01-18 23:39 ` Mark Smith
2010-01-19 10:11   ` David Miller
2010-01-19 10:48     ` Mark Smith
2010-01-19 11:13       ` David Miller
2010-01-19 10:12 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).