Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3983612ybi; Mon, 29 Jul 2019 16:52:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOc6RJlkMtGXVH4G3+K3UUrLjWdrZWHM93msjS+ZyeS3M8atq1R/WSUPQaohnt74u8w2s/ X-Received: by 2002:a63:184b:: with SMTP id 11mr45643469pgy.112.1564444337001; Mon, 29 Jul 2019 16:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564444336; cv=none; d=google.com; s=arc-20160816; b=gIxvIrKb8VcV2wPF1VtbsWMssFPhGoHrNhaIQRY+/yh/cip52Y7+0Ou5XY0rvaKCDL tAtv0g++FaGoUdlXW3ZMpKsG1BH+v+5ZlQtd2Beebn5DCVtciSA2Gj1a8wptvW5VRJsI V8aqkC5J/lzzLf6E0qnVY8WqlsOdyWNnWsXYmc3qA4uyooa/zHj6iodvRTXVaMYH3xh0 WMU1CNeulLCpw8rKxFoN2Q6nJqDi9KzXUrSalETfeYRmQHqbzQF9h6B2qItxOxn/Drbu pfyuUnLGVPwmMlbM0IAkt/dLFWL1KGJ1kcW9EiHgkku8y2V2cQtIYQtzG6bN6nUWXp1a o+5A== 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=qfK3oN2BDWLqEjBHIvP4G4U9LMo9rLSMHX78Dl1NjxY=; b=egbSy+XJVLf/uM/IOnI0JljfEDkmYncNi8VzStRoG5qra6yG/2p3V5LNiuQUX6Z+qM JCox/AodE7tGYUt6PTpp15+2+DfbXR0dAt6p06deSlge9Mnez+6kCAHBvBWdszFcCirk Fx6H0p36BPMLOy50Lz8VWKU88X7r/f/wDN/tpBLpIC3ByZEdoUZoLZsOqmEmpN09Z+6I /3Z/0QxG/lsjfjA2PwGwOyCRbHw+pnYNOJKaO64j9y0RB4EQeqmuC7NgbDlOUnIdrJUL HYG/w+8xzNehGMp3tAXoGUjqx2NKoTs6FqmipDt+Vgz7wFUbYh4cusLJpTB70luu47dB qDkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XP++lUOF; 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 q66si25268822pjq.109.2019.07.29.16.52.01; Mon, 29 Jul 2019 16:52:16 -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=XP++lUOF; 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 S1729998AbfG2T2e (ORCPT + 99 others); Mon, 29 Jul 2019 15:28:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729987AbfG2T2b (ORCPT ); Mon, 29 Jul 2019 15:28:31 -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 649332070B; Mon, 29 Jul 2019 19:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428510; bh=bU8JmnIf0S2UTSfiMcOwDN2VXep2/+pVvG31xsfqtKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XP++lUOFyFdPJg0AfTGEYuV92Z3YmRF/TbY4YBfDwVU5OT2986W72HCSuVyFm5OwK QO5CXA/aUfubSxAlzJ69IdLOwecw9QE3My2XmIyMPzAnkVTE+huV5cPPXcuOIz/F35 N7nHPbXfEc9w1IW2nLR6qAyUWlSaJ2BdHp9t2e9o= 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 4.14 097/293] Bluetooth: 6lowpan: search for destination address in all peers Date: Mon, 29 Jul 2019 21:19:48 +0200 Message-Id: <20190729190832.052222758@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 4e2576fc0c59..357475cceec6 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -187,10 +187,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