From patchwork Fri Oct 10 21:15:46 2014 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: 4191 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=212.227.15.14; helo=mout.web.de; envelope-from=linus.luessing@web.de; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from mout.web.de (mout.web.de [212.227.15.14]) by open-mesh.org (Postfix) with ESMTPS id 9AFDA600887 for ; Fri, 10 Oct 2014 23:15:49 +0200 (CEST) Received: from localhost ([178.162.209.232]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MCIUL-1XUDED3gAb-009716; Fri, 10 Oct 2014 23:15:49 +0200 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 10 Oct 2014 23:15:46 +0200 Message-Id: <1412975746-6856-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Provags-ID: V03:K0:e6o5ykyvoC2HjiInOTjwJfadf1Ij02KRw3gutfsM7sUYyjioK6+ EyjWl/G3Gv34+dWfnDOvDkWwNYrPpeZF94bmB5xC5fcInkU8A6Qtn45fZeIkO54/Tz9sjba JOrBJ0ldwgBZsbF11LNkEnYD1Y0V+MTittDk/nx4VVdgAsGqcZltdgjrmGa6z+Y74Oy+QIW sfI3ICTOuZZsOp94MjCSA== X-UI-Out-Filterresults: notjunk:1; Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix counter for multicast supporting nodes 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: Fri, 10 Oct 2014 21:15:49 -0000 A miscounting of nodes having multicast optimizations enabled can lead to multicast packet loss in the following scenario: If the first OGM a node receives from another one has no multicast optimizations support (no multicast tvlv) then we are missing to increase the counter. This potentially leads to the wrong assumption that we could safely use multicast optimizations. Fixings this by increasing the counter if the initial OGM has the multicast TVLV unset, too. Introduced by 77ec494490d60d89b42cd01d5dbf8dee04503623 ("batman-adv: Announce new capability via multicast TVLV") Signed-off-by: Linus Lüssing Reported-by: Tobias Hachmer --- multicast.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/multicast.c b/multicast.c index 96b66fd..02c2e0c 100644 --- a/multicast.c +++ b/multicast.c @@ -686,11 +686,13 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, if (orig_initialized) atomic_dec(&bat_priv->mcast.num_disabled); orig->capabilities |= BATADV_ORIG_CAPA_HAS_MCAST; - /* If mcast support is being switched off increase the disabled - * mcast node counter. + /* If mcast support is being switched off or if this is an initial + * OGM without mcast support then increase the disabled mcast + * node counter. */ } else if (!orig_mcast_enabled && - orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) { + (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST || + !orig_initialized)) { atomic_inc(&bat_priv->mcast.num_disabled); orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_MCAST; }