From patchwork Sun May 6 19:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Leonardo_M=C3=B6rlein?= X-Patchwork-Id: 17337 X-Patchwork-Delegate: a@unstable.cc 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 B9CC48145A; Sun, 6 May 2018 22:32:09 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=80.67.31.31; helo=smtprelay04.ispgateway.de; envelope-from=me@irrelefant.net; receiver= X-Greylist: delayed 770 seconds by postgrey-1.36 at open-mesh.org; Sun, 06 May 2018 22:21:52 CEST Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.31.31]) by open-mesh.org (Postfix) with ESMTPS id 7CDB680107 for ; Sun, 6 May 2018 22:21:52 +0200 (CEST) Received: from [79.232.139.20] (helo=orange.lan) by smtprelay04.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fFPlL-0000T5-Ay; Sun, 06 May 2018 21:56:03 +0200 From: =?utf-8?q?Leonardo_M=C3=B6rlein?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 6 May 2018 21:55:59 +0200 Message-Id: <20180506195559.32602-1-me@irrelefant.net> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Df-Sender: bWVAaXJyZWxlZmFudC5uZXQ= X-Mailman-Approved-At: Sun, 06 May 2018 22:32:08 +0200 Subject: [B.A.T.M.A.N.] [RFC PATCH] batman-adv: mitigate issue when empty vlan is received 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 Cc: =?utf-8?q?Leonardo_M=C3=B6rlein?= Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" This patch is not a fix for the issue itself, but a fix for the other nodes, which are also influenced by the issue. - Some (affected) nodes send TT announcements for an empty vlan (for now only seen with vlan_id = 0). - This behaviour is a bug! Batman-adv nodes must not send TT announcements for empty vlans. - The receiving batman-adv can not handle incoming TT announcements with empty vlans. (The crc check routine batadv_tt_global_check_crc() fails.) - As the receiving node thinks, the crc is broken, it does a full table request then. - The announcing node sends a TT full table to the receiving node then, which also contains the empty vlan, so *batadv_tt_global_check_crc()* fails again on the receiver side. - This causes a lot of unneeded TT traffic. In Freifunk Hannover we decreased the amount of from ~20kpp/s to ~4kpp/s on our supernodes. We have ~800 nodes, which are connected via vpn to one of six supernodes. Those supernodes are connected with each other in a fully connected mesh. Signed-off-by: Leonardo Mörlein --- net/batman-adv/translation-table.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 0225616d..d2a843fd 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -2996,8 +2996,21 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node, vlan = batadv_orig_node_vlan_get(orig_node, ntohs(tt_vlan_tmp->vid)); - if (!vlan) - return false; + if (!vlan) { + /* Due to a bug, some originators send TT + * announcements for empty vlans. As the receiving + * nodes will ignore those empty vlans (they do not + * add a batadv_orig_node_vlan into the transglobal + * for the originating node), crc check will fail + * here. To circumvent this issue, we skip the + * verification for the vlan if the crc is + * equal to 0x00000000. + */ + if (tt_vlan_tmp->crc == 0x00000000) + continue; + else + return false; + } crc = vlan->tt.crc; batadv_orig_node_vlan_put(vlan);