Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9933259ybi; Wed, 24 Jul 2019 12:35:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgyENVaPhifAdd6aj1hfhdrUFg0QIawqL0sdKniuHM/1QgBaR6kZAMmwqnyGlqqYPo2NPu X-Received: by 2002:a17:90a:2343:: with SMTP id f61mr90273748pje.130.1563996900354; Wed, 24 Jul 2019 12:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996900; cv=none; d=google.com; s=arc-20160816; b=tO//nUy6di9YHdyyOxJCV3Ha++mkuOTreYaMODpIDOMhB3hAUB33JIgYaB7mEUwc0Z Ty5+n/yAOV+tKRnzfFeQxI8qf4cF+8nNppDLB7YYuKzftrngxeN/jSt8Q0LJS/wQ5NlZ H6oW1qIGDQKmr9gUXghk+K+yTR89KDrl0XnGV1BbasytNbq79ixp726bUd6MRtTPSrJA ogOLXoMVCb/0v9OhWVvYNpFCmxpZvzBVNMAC9BDlC4Zlf2cSvA0w5gfpES0/TSX33zl3 YcYWj6aC/mhmfNNZBeQPVsRcaYfKp19T6rDdhATxWxHjgRH4cq4YlmpBCT+mVLRdqcu0 VLuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M4t+yqSkmXP1TSPVgq4bDcOAo5ABfogffd+Sb738Ifw=; b=pz9CHNOlBpae/9B4sYG0ig+ytaQz6RWu3pDSTxa7GfuL2bzYc+JSaTvbsRglnY/44F O2K+1bXeBa7uyAkdHanij8hWOY13GyDZlPyo7isf7zBY9x/FHG7doa8uC4bywN6TzbQX cQKiriCOHcC3dL0R+upeHVWIHwSFt74KoKJBnzFhqoRoxbMto4JM/MFNrs63vbUF7geI L3h9UO6VeUgQCcUdJRBBMdJR/uYghO+OHC0sUEYicOlqt/p6ru5yjUyEMgYFLYFJxHmo owQZKCXT4sRs2c+vE/qSk8aQ3zhrEgV3G1LdnJ8zSdjoJWz/X2lgTwH5yIH0x83BGsEh WiJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uistiiim; 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 g8si13382333plt.273.2019.07.24.12.34.45; Wed, 24 Jul 2019 12:35:00 -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; dkim=pass header.i=@kernel.org header.s=default header.b=uistiiim; 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 S2388960AbfGXTdx (ORCPT + 99 others); Wed, 24 Jul 2019 15:33:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388132AbfGXTdu (ORCPT ); Wed, 24 Jul 2019 15:33:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 EF05420659; Wed, 24 Jul 2019 19:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996829; bh=GrVsrM3NjNGREcJwnL+NGv1B65Ib17x0rVucDc+1WS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uistiiim/PHHX09BPEHzU5W3bA1Isie8P8bCHYdiIyplP8Yqidn11bfAvqQTVu83R MLahlDKfhszB+czpWcsBqzXkWrfb7its/tXrXBdLhetVa5u+YBW0XbEkVCvf8tpddL aGlGzwP3A17gy/G/qkko7tVzsubE6BeCjrYEb/SI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jukka Rissanen , Michael Scott , Josua Mayer , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.2 231/413] Bluetooth: 6lowpan: search for destination address in all peers Date: Wed, 24 Jul 2019 21:18:42 +0200 Message-Id: <20190724191751.605698017@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit b188b03270b7f8568fc714101ce82fbf5e811c5a ] 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 Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- 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.20.1