From patchwork Mon Jan 18 22:58:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Octavian Purdila X-Patchwork-Id: 43161 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F694B7C7E for ; Tue, 19 Jan 2010 10:02:21 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756545Ab0ARXCK (ORCPT ); Mon, 18 Jan 2010 18:02:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756214Ab0ARXCJ (ORCPT ); Mon, 18 Jan 2010 18:02:09 -0500 Received: from ixro-out-rtc.ixiacom.com ([92.87.192.98]:1702 "EHLO ixro-ex1.ixiacom.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756223Ab0ARXCI (ORCPT ); Mon, 18 Jan 2010 18:02:08 -0500 Received: from ixro-opurdila-lap.localnet ([10.205.9.174]) by ixro-ex1.ixiacom.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Jan 2010 01:02:06 +0200 Subject: [net-next PATCH v3] ipv4: allow warming up the ARP cache with request type gratuitous ARP From: Octavian Purdila Organization: Ixia To: David Miller Cc: Julian Anastasov , Laurent Chavey , netdev@vger.kernel.org Date: Tue, 19 Jan 2010 00:58:44 +0200 MIME-Version: 1.0 Message-Id: <201001190058.44495.opurdila@ixiacom.com> X-OriginalArrivalTime: 18 Jan 2010 23:02:07.0011 (UTC) FILETIME=[41CD6F30:01CA9892] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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); }