From patchwork Sun Sep 23 09:16:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 2298 Return-Path: Received: from nm23-vm5.bullet.mail.ukl.yahoo.com (nm23-vm5.bullet.mail.ukl.yahoo.com [217.146.176.135]) by open-mesh.org (Postfix) with SMTP id 072206011CE for ; Sun, 23 Sep 2012 11:16:13 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; insecure key" header.i=@yahoo.de header.b=FvLd+az+; dkim-adsp=pass; dkim-atps=neutral Received: from [217.146.183.213] by nm23.bullet.mail.ukl.yahoo.com with NNFMP; 23 Sep 2012 09:16:13 -0000 Received: from [217.146.182.74] by tm6.bullet.mail.ukl.yahoo.com with NNFMP; 23 Sep 2012 09:16:13 -0000 Received: from [127.0.0.1] by smtp105.mail.ukl.yahoo.com with NNFMP; 23 Sep 2012 09:16:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1348391773; bh=ChZBxqTkHMfza8gVfOaavCT7zpVPEZRbNKBywbE+/+M=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FvLd+az+dGOgOZ5L+ZaSrzuQ4OnSh2ow67YCeOhsZtKRRFz7ASvF2FdYP5/VMzTXfJ9srZqp7N/ydu83x1jmn88FOn7+k1pqBPUik6iDkfKUQ7WJkY5RjiiFQ0WNEE4jgl9P9tF3TmRgN26ybw/YIn8WbEDyojQUnL/DuVU7Vyg= X-Yahoo-Newman-Id: 779041.55398.bm@smtp105.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: OuPxBx8VM1kE_beiqwFjMQo525pwI409bDyMWtRTkBiUnAu jaOp1m_VNfP2euHgmuYmz2E.uNlPDfaoEDoMbfiuV2K244Kp3DOHvcb4KoH9 xCH_qEEpUOVhOqt6FwxNTofLyaNw95lz.A8_E0CCZ2sEqfdxWm_YfdZxc2rA GWA3UtzNd2bC_7QLcMi2JHozbgFOyHqP9tAhdP4.fZIskpy0Fdz8EPgqH0Kt N40Szi6nzjgADTxIgob9aWPVr8sGzB2xNp0D1W6UuZHtKj5XX5_ZrHk6bomW f0KNeRBGOC2jFF7eRLiNspW80VirOA95KgUY5xJbF6U1LkbrrSSh_V__MMqv OR_6tetnQlccL8ulk3_g1wEnoV9FYOVrg5ncPXOm_XJa52h.0WShteiAk7gm SGxt.zOucb6Fvo7g- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@1.36.73.97 with plain) by smtp105.mail.ukl.yahoo.com with SMTP; 23 Sep 2012 02:16:10 -0700 PDT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 23 Sep 2012 17:16:03 +0800 Message-Id: <1348391763-16924-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <201209231715.28695.lindner_marek@yahoo.de> References: <201209231715.28695.lindner_marek@yahoo.de> MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [PATCHv3] batman-adv: Fix symmetry check / route flapping in multi interface setups X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 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: Sun, 23 Sep 2012 09:16:14 -0000 From: Linus Lüssing If receiving an OGM from a neighbor other than the currently selected and if it has the same TQ then we are supposed to switch if this neighbor provides a more symmetric link than the currently selected one. However this symmetry check currently is broken if the interface of the neighbor we received the OGM from and the one of the currently selected neighbor differ: We are currently trying to determine the symmetry of the link towards the selected router via the link we received the OGM from instead of just checking via the link towards the currently selected router. This leads to way more route switches than necessary and can lead to permanent route flapping in many common multi interface setups. This patch fixes this issue by using the right interface for this symmetry check. Signed-off-by: Linus Lüssing --- bat_iv_ogm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index 7f0adad..75403a4 100644 --- a/bat_iv_ogm.c +++ b/bat_iv_ogm.c @@ -657,6 +657,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, struct batadv_neigh_node *router = NULL; struct batadv_orig_node *orig_node_tmp; struct hlist_node *node; + int if_num; uint8_t sum_orig, sum_neigh; uint8_t *neigh_addr; uint8_t tq_avg; @@ -743,12 +744,14 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, if (router && (neigh_node->tq_avg == router->tq_avg)) { orig_node_tmp = router->orig_node; spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); - sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; + if_num = router->if_incoming->if_num; + sum_orig = orig_node_tmp->bcast_own_sum[if_num]; spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); orig_node_tmp = neigh_node->orig_node; spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); - sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; + if_num = neigh_node->if_incoming->if_num; + sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); if (sum_orig >= sum_neigh)