Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2248168imm; Thu, 7 Jun 2018 07:40:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKQUjvK9wTm1sOVG2zhwUQdFeG/9YmJbT2AcHqHRP8PYtMiAIO6J4S3FArxteBpDoBC+6dd X-Received: by 2002:a63:618f:: with SMTP id v137-v6mr1847341pgb.145.1528382447058; Thu, 07 Jun 2018 07:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528382447; cv=none; d=google.com; s=arc-20160816; b=CQ4IvIUu4JDPy2qYSK/SUKgjKysffso/ihXCSHDznbaylrWYcVfRRuqXQ1xl9Il9T+ EhINHWHl3kCLvQ3vzcg55ty+m3V22mCR3IGyCmpNfCDZhLTZVzbydpY+e3qBohgkjDqK xQd9WSU9RIU29z1fE/FdZwGVN5JFn2vQZ4fHm3+mmmzqDAVL4LN30lAngQQRW3Yj2FmP vlHYHuozV6ZqVfxeV+K8epefA0LHT8lvwm3sHdsH8pIHfJfQJ5b5yzwISlG17/IHbc22 WWTrmxhN8Ew8e6t0mWCkROX6tR6hOwO6im1ifxRbJdxz63/FVpBId4NRQPc0Od158DZa nAGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=Iuxdsrr/7YbCoSlp6gJJ8Al2KS3uw3pdgwKH3azq1Z4=; b=gcFCDYW825RLtzaWvsQ+/hdYc/WHCyz6ti/QCrkI3xPZfs9Go3KK1bAhuNVMaxzpwF uCxuuH2bkiQ8UP6KaqaqsrGF/N0lnu1lekp421NhwyW+JkRVihjyMdtaLcyWyBIhxD6C lkPQJzCyI4jjOEM9kLwMvUbyFTiHiZDrMqn8JCgjY++gXfo1bFxdHOXS1Uc85BWQo3A/ 3HQ1ZBGWxOguQuVmtWivOykFagdCqwc1l6auAs5NDsiX61nCGsbyQguBPy4cLWDD+xqY WE8wSIukQ0ZUXtbGXRoKPd6+O/78C0ux6d8FENYJhleZjHebK3L0thz6jvSgRen5Q1Dp 5wJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si9371309pgr.206.2018.06.07.07.40.32; Thu, 07 Jun 2018 07:40:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934259AbeFGOio (ORCPT + 99 others); Thu, 7 Jun 2018 10:38:44 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40483 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934131AbeFGOil (ORCPT ); Thu, 7 Jun 2018 10:38:41 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbJ-0005Zq-7y; Thu, 07 Jun 2018 15:09:17 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbF-0003Ih-3S; Thu, 07 Jun 2018 15:09:13 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "=?UTF-8?q?Linus=20L=C3=BCssing?=" , "Sven Eckelmann" , "Simon Wunderlich" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 395/410] batman-adv: fix packet loss for broadcasted DHCP packets to a server In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Linus Lüssing commit a752c0a4524889cdc0765925258fd1fd72344100 upstream. DHCP connectivity issues can currently occur if the following conditions are met: 1) A DHCP packet from a client to a server 2) This packet has a multicast destination 3) This destination has a matching entry in the translation table (FF:FF:FF:FF:FF:FF for IPv4, 33:33:00:01:00:02/33:33:00:01:00:03 for IPv6) 4) The orig-node determined by TT for the multicast destination does not match the orig-node determined by best-gateway-selection In this case the DHCP packet will be dropped. The "gateway-out-of-range" check is supposed to only be applied to unicasted DHCP packets to a specific DHCP server. In that case dropping the the unicasted frame forces the client to retry via a broadcasted one, but now directed to the new best gateway. A DHCP packet with broadcast/multicast destination is already ensured to always be delivered to the best gateway. Dropping a multicasted DHCP packet here will only prevent completing DHCP as there is no other fallback. So far, it seems the unicast check was implicitly performed by expecting the batadv_transtable_search() to return NULL for multicast destinations. However, a multicast address could have always ended up in the translation table and in fact is now common. To fix this potential loss of a DHCP client-to-server packet to a multicast address this patch adds an explicit multicast destination check to reliably bail out of the gateway-out-of-range check for such destinations. The issue and fix were tested in the following three node setup: - Line topology, A-B-C - A: gateway client, DHCP client - B: gateway server, hop-penalty increased: 30->60, DHCP server - C: gateway server, code modifications to announce FF:FF:FF:FF:FF:FF Without this patch, A would never transmit its DHCP Discover packet due to an always "out-of-range" condition. With this patch, a full DHCP handshake between A and B was possible again. Fixes: be7af5cf9cae ("batman-adv: refactoring gateway handling code") Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich [bwh: Backported to 3.16: Drop redundant change to initialisation] Signed-off-by: Ben Hutchings --- --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c @@ -804,6 +804,9 @@ bool batadv_gw_out_of_range(struct batad vid = batadv_get_vid(skb, 0); + if (is_multicast_ether_addr(ethhdr->h_dest)) + goto out; + orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, ethhdr->h_dest, vid); if (!orig_dst_node)