From patchwork Sun Apr 7 10:37:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 17882 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id A6F5882687; Sun, 7 Apr 2019 12:37:23 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=c0d3.blue header.i=@c0d3.blue header.b="pl0/0CHi"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=138.201.29.205; helo=mail.aperture-lab.de; envelope-from=linus.luessing@c0d3.blue; receiver= Received: from mail.aperture-lab.de (mail.aperture-lab.de [138.201.29.205]) by open-mesh.org (Postfix) with ESMTPS id 010D482669 for ; Sun, 7 Apr 2019 12:37:19 +0200 (CEST) From: =?utf-8?q?Linus_L=C3=BCssing?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c0d3.blue; s=2018; t=1554633439; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6b6kig4OgIl9omswmGN8rewe5DzIs3B7MS6/Fyhqu60=; b=pl0/0CHiWlk59g/Mx9xWDX0c4Cz9+mnF2ilJCP7rA2w0nOlM3PxPLa+/4hBYpndbWxcR4q ds633EkpE5SA7zKw+9fetNYoZd5E2FefY8i+iDdJkNzexwAbo4XzNFLguX9pk9tFL38Vec LAFqW7CZmr1ja59XYtno0PnMKtj559g+VfnscQ5pOnGAHXs4oApPRAb+V5GbgjudzBud0d bXxOpU5CbeDUJe48kquGpl9LR179EA7dLeXdt698q8qMqOnei7FubgUL4gooaq+dvdhmSL /GKJEw98QpRvkExgmJlB03iD7/DV63sfQ0bLC/qIp+xDZQvmryABTpooiKyA5w== To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 7 Apr 2019 12:37:02 +0200 Message-Id: <20190407103702.30435-3-linus.luessing@c0d3.blue> In-Reply-To: <20190407103702.30435-1-linus.luessing@c0d3.blue> References: <20190407103702.30435-1-linus.luessing@c0d3.blue> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=c0d3.blue; s=2018; t=1554633439; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6b6kig4OgIl9omswmGN8rewe5DzIs3B7MS6/Fyhqu60=; b=bbxZPRVT75m83wF2ipFXVcUTPa4cJUB5y92Po6H4h9j9syaK33yj0NJX5DG87HBlZIm6dU 9GUtHIqXTyrVTO0W7UFnVfvr2fiMlNMMhg22ffch2+ezFHoXIJ+pg1hRQ5ODnC2n5k17q/ 8PjxxfHDnsE/IB965bEqsTTknYYEvHNMwhVudwkB7bnxprNzLOQP8N9nLT7xWdVxbWRXvm YDu+ZyPzl/Cfg7x58bf74JvlWTqvInNG8Txxaw82uQhLEgi+gjzAoYXM05PJEK85vtdOHQ kR8L5mIuKz2qaiwOGmNbfS6WbUtajdlUHaT9D4fQK9kgHa+lWOIfQ+g/iWDJsA== ARC-Seal: i=1; s=2018; d=c0d3.blue; t=1554633439; a=rsa-sha256; cv=none; b=MWI0WtA+X/QFGAmy4j8aZ4asRX1YLiddRA+t0/IOsJjrZlldMJYkYdXtLLa5BvF9vhn0Bq kf2y/MiZqgrdcgjiitYwpuoTk7hO6HuiErO1TXN+E1Xi8utkHqdbPEYVw8JtIwYg53q6Si PNgNXUmYWdbB4X96eVyxPNlJ0S8FwgdB9xhv7X1WE/WMVLroTAqsG1pqdTLQgM2/hsEK06 R9tAGrYy6iL6XEnn9sinKUJKdozwOVJ9XzNkuwsiHCCYXIVe1Gw7WaDNp4W0EohnPE/5LJ AnAXNpNMUPBi15JBNOK6i1RaG6tj0XMidrJ9REq3tukmqrKledhJ2ilq1Ad6Hw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=linus.luessing@c0d3.blue smtp.mailfrom=linus.luessing@c0d3.blue Authentication-Results: ORIGINATING; auth=pass smtp.auth=linus.luessing@c0d3.blue smtp.mailfrom=linus.luessing@c0d3.blue Subject: [B.A.T.M.A.N.] [PATCH v3 2/2] batman-adv: increase DAT DHT timeout X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" Currently, the DHT_GET messages of the DAT will likely be left unanswered due to the following issues: When a node has a matching DAT Cache entry for a local ARP Request then this node will answer it directly with the information provided by the cache. This however, will likely lead to missing ARP Replies from the original host. Which in turn leads to the DAT DHT not being updated. Then the local DAT cache entry will time out, triggering a unicasted DHT_GET. However, as the 5min. timeout has passed, the DAT DHT candidates will likely have purged their entry, too. So basically this results in an ARP Request broadcast fallback every five minutes. A second issue is that it is quite common that a host which has long gone offline will be tried to be contacted by another one at some remote period larger than the current 5min. timeout. This too leads to flooded ARP Requests. With this patch the purge timeout for DAT DHT entries is increased to 30min to reduce the number of DAT ARP broadcast fallbacks. Signed-off-by: Linus Lüssing --- net/batman-adv/distributed-arp-table.c | 22 +++++++++++++++++----- net/batman-adv/main.h | 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 97444342..b2173c5f 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -132,15 +132,27 @@ static void batadv_dat_entry_put(struct batadv_dat_entry *dat_entry) } /** - * batadv_dat_to_purge() - check whether a dat_entry has to be purged or not + * batadv_dat_cache_to_purge() - check if a cache entry has to be purged or not * @dat_entry: the entry to check * * Return: true if the entry has to be purged now, false otherwise. */ -static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry) +static bool batadv_dat_cache_to_purge(struct batadv_dat_entry *dat_entry) { return batadv_has_timed_out(dat_entry->last_update, - BATADV_DAT_ENTRY_TIMEOUT); + BATADV_DAT_CACHE_ENTRY_TIMEOUT); +} + +/** + * batadv_dat_dht_to_purge() - check if a DHT entry has to be purged or not + * @dat_entry: the entry to check + * + * Return: true if the entry has to be purged now, false otherwise. + */ +static bool batadv_dat_dht_to_purge(struct batadv_dat_entry *dat_entry) +{ + return batadv_has_timed_out(dat_entry->last_update, + BATADV_DAT_DHT_ENTRY_TIMEOUT); } /** @@ -201,8 +213,8 @@ static void batadv_dat_purge(struct work_struct *work) priv_dat = container_of(delayed_work, struct batadv_priv_dat, work); bat_priv = container_of(priv_dat, struct batadv_priv, dat); - __batadv_dat_purge(bat_priv->dat.cache_hash, batadv_dat_to_purge); - __batadv_dat_purge(bat_priv->dat.dht_hash, batadv_dat_to_purge); + __batadv_dat_purge(bat_priv->dat.cache_hash, batadv_dat_cache_to_purge); + __batadv_dat_purge(bat_priv->dat.dht_hash, batadv_dat_dht_to_purge); batadv_dat_start_timer(bat_priv); } diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index c59afcba..cb30c042 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -38,7 +38,8 @@ #define BATADV_TT_WORK_PERIOD 5000 /* 5 seconds */ #define BATADV_ORIG_WORK_PERIOD 1000 /* 1 second */ #define BATADV_MCAST_WORK_PERIOD 500 /* 0.5 seconds */ -#define BATADV_DAT_ENTRY_TIMEOUT (5 * 60000) /* 5 mins in milliseconds */ +#define BATADV_DAT_CACHE_ENTRY_TIMEOUT (5 * 60000) /* 5 mins in milliseconds */ +#define BATADV_DAT_DHT_ENTRY_TIMEOUT (30 * 60000) /* 30 mins in milliseconds */ /* sliding packet range of received originator messages in sequence numbers * (should be a multiple of our word size) */