From patchwork Sat Aug 6 14:59:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16586 X-Patchwork-Delegate: mareklindner@neomailbox.ch 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 8967D82E7B; Sat, 6 Aug 2016 17:00:00 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=pYRU3eTa; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id E6A5782E75 for ; Sat, 6 Aug 2016 16:59:47 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C7B8FD0000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c7:b8fd::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 56BAE1100E7; Sat, 6 Aug 2016 16:59:47 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1470495587; bh=nNPm55Gcecd9c0w0aIPslr2fWK9kYhbUZ7MItC6RUyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pYRU3eTaYdK4+wp6LEF1Kocpxt3YaWdSEV3mOEeTUomL3d33cAaG4KRWOxfXpbLmn TQjLaq4uYkotk3f2XUtt2iI3KbAQNh5T+vj2h8/XVIY4J3klVHWX2P80gCcoEU+Sjc 7xnDFHWFAPSoEAq9cw4Q4grjvLz7RAmpfsaTLBe0= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 6 Aug 2016 16:59:38 +0200 Message-Id: <1470495578-20476-3-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470495578-20476-1-git-send-email-sven@narfation.org> References: <1470495578-20476-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH v2 3/3] batman-adv: Reject unicast packet for zero/mcast recepient X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 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" An unicast batman-adv packet cannot be transmitted to a multicast or zero mac address. So reject incoming packets which still have these classes of addresses as destination mac address in the outer ethernet header. Signed-off-by: Sven Eckelmann --- v2: - clarify in commit message that only the outer ethernet header is affected (thanks Linus) --- net/batman-adv/routing.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index e2b91e6..65f405b 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -353,8 +353,8 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, ethhdr = eth_hdr(skb); - /* packet with unicast indication but broadcast recipient */ - if (is_broadcast_ether_addr(ethhdr->h_dest)) + /* packet with unicast indication but non-unicast recipient */ + if (!is_valid_ether_addr(ethhdr->h_dest)) goto out; /* packet with broadcast/multicast sender address */ @@ -445,8 +445,8 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, ethhdr = eth_hdr(skb); - /* packet with unicast indication but broadcast recipient */ - if (is_broadcast_ether_addr(ethhdr->h_dest)) + /* packet with unicast indication but non-unicast recipient */ + if (!is_valid_ether_addr(ethhdr->h_dest)) return -EBADR; /* packet with broadcast/multicast sender address */