From patchwork Thu Feb 9 23:41:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1524 Return-Path: Received: from latitanza.investici.org (latitanza.investici.org [82.94.249.234]) by open-mesh.org (Postfix) with ESMTPS id BAE706008D2 for ; Fri, 10 Feb 2012 00:42:52 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 0F6E39835B; Thu, 9 Feb 2012 23:42:52 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org 0F6E39835B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1328830972; bh=1SEhOkLUnrS+XR4QJMbvqBhezm8wfY+bUF9MclKFTG4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=o68/I62x+mtQDLJRKWQT8G/DkzH6Ypr3ndgquILkc4uqsfLd39cw28141ig8a3Vh/ FigKccfvKhsubYcoZC0wvSQaymo6+Sgb6HpCQsTVcajtDUuGiruaI8sXjs3+fqjgUv pUk6GR4ossTfz7TLKZfIWXbmBY6M5GFFd/Y6X3WI= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 10 Feb 2012 00:41:39 +0100 Message-Id: <1328830902-11574-7-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1328830902-11574-1-git-send-email-ordex@autistici.org> References: <1328830902-11574-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCHv5 6/9] batman-adv: Distributed ARP Table - increase default soft_iface ARP table timeout X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2012 23:42:52 -0000 The default timeout value for ARP entries belonging to any soft_iface ARP table has been incremented by a factor 4. This is necessary because the DHT will store several network entries in the soft_iface ARP table. Signed-off-by: Antonio Quartulli --- distributed-arp-table.c | 19 +++++++++++++++++++ distributed-arp-table.h | 1 + main.h | 3 +++ soft-interface.c | 2 ++ 4 files changed, 25 insertions(+), 0 deletions(-) diff --git a/distributed-arp-table.c b/distributed-arp-table.c index 7e9130b..5c81086 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -23,6 +23,7 @@ #include /* needed to use arp_tbl */ #include +#include #include "main.h" #include "distributed-arp-table.h" @@ -478,3 +479,21 @@ bool arp_drop_broadcast_packet(struct bat_priv *bat_priv, } return false; } + +void arp_change_timeout(struct net_device *soft_iface, const char *name) +{ + struct in_device *in_dev = in_dev_get(soft_iface); + if (!in_dev) { + pr_err("Unable to set ARP parameters for the batman interface " + "'%s'\n", name); + return; + } + + /* Introduce a delay in the ARP state-machine transactions. Entries + * will be kept in the ARP table for the default time multiplied by 4 */ + in_dev->arp_parms->base_reachable_time *= ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->gc_staletime *= ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->reachable_time *= ARP_TIMEOUT_FACTOR; + + in_dev_put(in_dev); +} diff --git a/distributed-arp-table.h b/distributed-arp-table.h index cd779f4..c9c6624 100644 --- a/distributed-arp-table.h +++ b/distributed-arp-table.h @@ -54,6 +54,7 @@ bool dat_snoop_incoming_arp_reply(struct bat_priv *bat_priv, struct sk_buff *skb); bool arp_drop_broadcast_packet(struct bat_priv *bat_priv, struct forw_packet *forw_packet); +void arp_change_timeout(struct net_device *soft_iface, const char *name); /* hash function to choose an entry in a hash table of given size */ /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ diff --git a/main.h b/main.h index eed55cb..6cbd5ce 100644 --- a/main.h +++ b/main.h @@ -71,6 +71,9 @@ #define ARP_REQ_DELAY 250 /* numbers of originator to contact for any STORE/GET DHT operation */ #define DHT_CANDIDATES_NUM 3 +/* Factor which default ARP timeout values of the soft_iface table are + * multiplied by */ +#define ARP_TIMEOUT_FACTOR 4 #define LOG_BUF_LEN 8192 /* has to be a power of 2 */ diff --git a/soft-interface.c b/soft-interface.c index ab3fb31..7b11aef 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -379,6 +379,8 @@ struct net_device *softif_create(const char *name) goto free_soft_iface; } + arp_change_timeout(soft_iface, name); + bat_priv = netdev_priv(soft_iface); atomic_set(&bat_priv->aggregated_ogms, 1);