Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4616712ybi; Sat, 6 Jul 2019 09:03:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWWfjI75+qrsNAqx2x7YTEvueW/qdGc7gbNjJpHZ3P+Fn/VJJrbPcmQRE7LrOpkhj6Mra2 X-Received: by 2002:a65:5348:: with SMTP id w8mr11613860pgr.176.1562429000917; Sat, 06 Jul 2019 09:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562429000; cv=none; d=google.com; s=arc-20160816; b=CaiMfuYMIeyBdceU11fCJvGwNxwebnWpcMW+35JBW1MyYuxhwvi3xjvI99zuor319C y0a0y/IdSXKNsmi33UXD9VKINxFNEfh+ILHUWbxU26v0fv/XEc7SXiDmn6G1ov/mUGAL 22uqyrnaODysVzHx7UxAKrGczS22CjoPBTnjIMPUS8vagh+UZk5aw53qgHf+QyTUD7mp Ag1QTgM1d06vBZAnN1G6ZJr1EBzCLv6Gv9YfF++9H560saDdxjxYqFdxn/DlDEntehob qaWdg9xmLOqGa9sITya/vBLztNlPwocfwZeHs9UQvTB/ZAt2bDYFiv0+uyqWnJ/2NDK8 uUVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+ZOF8lRzJ6J9sDMNJ1bqv7dD5hAw23ET+GbOXNcBqNE=; b=nGt5ia4sxElkqO1wBc7znx6o/WFnfy3qmFIdIwcGZBekF8WS+DPw8lNZJnIjadG04/ PaKHFMhTIMTICd9i3l9DBFdXNvFW6EeZc0+Ada21mtRko/KWL7nOEQaVKSZjxudoI/nM rm8YXRVSBnG4OIn5yXzBz72ANT+xjcYmrXRNfOAyqzanrghnzp7am6TIiemLYIv4emCz FhGy55JJFBGOyVySFiFhCclzRf5BLnJSM78GzRx+n7yGu+oy93lV5bbYPIXmPVB1TdoW elJvMKyLuRdNXR6L2dKHrRUA3UUOmq8yZLRkCWgthmKTkqoOeg7L7qbVu6S24yb3gtVQ pkkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@jm0.eu header.s=strato-dkim-0002 header.b="Ctu/Inf2"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 h12si10314857pjq.63.2019.07.06.09.03.06; Sat, 06 Jul 2019 09:03:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@jm0.eu header.s=strato-dkim-0002 header.b="Ctu/Inf2"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbfGFQBB (ORCPT + 99 others); Sat, 6 Jul 2019 12:01:01 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:29062 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbfGFQBA (ORCPT ); Sat, 6 Jul 2019 12:01:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1562428858; s=strato-dkim-0002; d=jm0.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=+ZOF8lRzJ6J9sDMNJ1bqv7dD5hAw23ET+GbOXNcBqNE=; b=Ctu/Inf2SqR5ph29tZ5kTknU48a4K29QYGU7gPMzjiruZMT4cZHmpAGjrRiijV6oxX Htg4Xxo81wWR7QfAqxTI0HyMeKZ3bnvg6bbkt/CK56UNQbM4sC2sg3uunf0/GoXixkSm T5FfreCTF+6VLNkYXRxY5QuXGEaCCcYVljvPWtdlbC6wm0ZrFF+ld5xtTwQjSXjuOqv5 ak1E0Tdys1vGRnJyiBggCxIBKmAZsoU6VVt6jHEYHz0gAzzNC0rk8y5oZD/9WSVa/u7Z dxwJK3BPUSSqogdyM1TeJByLAUnRG8nMjG4QQxjm2s72bYJDwfaAqe3e37MfCXj10MQL /dmg== X-RZG-AUTH: ":JmMXYEHmdv4HaV2cbPh7iS0wbr/uKIfGM0EPWe8EZQbw/dDJ/fVPBaXaSiaF5/mu26zWKwNU" X-RZG-CLASS-ID: mo00 Received: from linux-1tvp.lan by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v66Fsw6Oy (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 6 Jul 2019 17:54:58 +0200 (CEST) From: josua.mayer@jm0.eu To: linux-bluetooth@vger.kernel.org Cc: Josua Mayer , Marcel Holtmann , Johan Hedberg , "David S. Miller" Subject: [PATCH v3 1/3] bluetooth: 6lowpan: search for destination address in all peers Date: Sat, 6 Jul 2019 17:54:46 +0200 Message-Id: <20190706155448.13382-2-josua.mayer@jm0.eu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190706155448.13382-1-josua.mayer@jm0.eu> References: <20190706155448.13382-1-josua.mayer@jm0.eu> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Josua Mayer Handle overlooked case where the target address is assigned to a peer and neither route nor gateway exist. For one peer, no checks are performed to see if it is meant to receive packets for a given address. As soon as there is a second peer however, checks are performed to deal with routes and gateways for handling complex setups with multiple hops to a target address. This logic assumed that no route and no gateway imply that the destination address can not be reached, which is false in case of a direct peer. Acked-by: Jukka Rissanen Tested-by: Michael Scott Signed-off-by: Josua Mayer --- net/bluetooth/6lowpan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 1555b0c6f7ec..9001bf331d56 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -180,10 +180,16 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, } if (!rt) { - nexthop = &lowpan_cb(skb)->gw; - - if (ipv6_addr_any(nexthop)) - return NULL; + if (ipv6_addr_any(&lowpan_cb(skb)->gw)) { + /* There is neither route nor gateway, + * probably the destination is a direct peer. + */ + nexthop = daddr; + } else { + /* There is a known gateway + */ + nexthop = &lowpan_cb(skb)->gw; + } } else { nexthop = rt6_nexthop(rt, daddr); -- 2.16.4