From patchwork Tue Sep 29 11:00:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 291238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F87C4741F for ; Tue, 29 Sep 2020 11:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48B7722204 for ; Tue, 29 Sep 2020 11:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377585; bh=qvdzGrCdpR/msg3CcRf0BZHpDkIJbQyWbMMnvIg9k3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=c/bv5Q+fYp/2H2A5r5lb1In0Q6jBYWEJ/sGN1zTAt+3UEk7l/TJ2qPNqYX3dE9t0T 1MzFzOaqAIe+V+h/Zhd03uy2kjeylD40gQhSVzdHNx3X6YjFRXN4ypUP742EIaiJd8 N1bDJ5VJk5Do5TIDu0dvliiHwHqi8r80spHSSg/w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728416AbgI2LGH (ORCPT ); Tue, 29 Sep 2020 07:06:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:42496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728376AbgI2LGA (ORCPT ); Tue, 29 Sep 2020 07:06:00 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 231CE21D43; Tue, 29 Sep 2020 11:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377559; bh=qvdzGrCdpR/msg3CcRf0BZHpDkIJbQyWbMMnvIg9k3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xqFx9FuG+kt2YEbuRfoQto/7+5sw70cm4Fso43TNrdbdnsDm8psr3omMj1OqcMIV+ QMLHZQ2hlVzrHkHWIumF0sBcfccG0CBEYx3qKdRytj4WGNpoiJR/lBNoGl0VMu+B5j t7KvWAakH5EzxDkhWKloXgV+Rtc49B5PimiT6MWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Linus_L=C3=BCssing?= , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 4.4 77/85] batman-adv: mcast/TT: fix wrongly dropped or rerouted packets Date: Tue, 29 Sep 2020 13:00:44 +0200 Message-Id: <20200929105932.043179957@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105928.198942536@linuxfoundation.org> References: <20200929105928.198942536@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Lüssing [ Upstream commit 7dda5b3384121181c4e79f6eaeac2b94c0622c8d ] The unicast packet rerouting code makes several assumptions. For instance it assumes that there is always exactly one destination in the TT. This breaks for multicast frames in a unicast packets in several ways: For one thing if there is actually no TT entry and the destination node was selected due to the multicast tvlv flags it announced. Then an intermediate node will wrongly drop the packet. For another thing if there is a TT entry but the TTVN of this entry is newer than the originally addressed destination node: Then the intermediate node will wrongly redirect the packet, leading to duplicated multicast packets at a multicast listener and missing packets at other multicast listeners or multicast routers. Fixing this by not applying the unicast packet rerouting to batman-adv unicast packets with a multicast payload. We are not able to detect a roaming multicast listener at the moment and will just continue to send the multicast frame to both the new and old destination for a while in case of such a roaming multicast listener. Fixes: a73105b8d4c7 ("batman-adv: improved client announcement mechanism") Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin --- net/batman-adv/routing.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index b3e8b0e3073c2..e470410abb44d 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -782,6 +782,10 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, vid = batadv_get_vid(skb, hdr_len); ethhdr = (struct ethhdr *)(skb->data + hdr_len); + /* do not reroute multicast frames in a unicast header */ + if (is_multicast_ether_addr(ethhdr->h_dest)) + return true; + /* check if the destination client was served by this node and it is now * roaming. In this case, it means that the node has got a ROAM_ADV * message and that it knows the new destination in the mesh to re-route