Skip to content

Commit 58aa832

Browse files
Artoxgregkh
authored andcommitted
Bluetooth: 6lowpan: search for destination address in all peers
[ Upstream commit b188b03 ] 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 <[email protected]> Tested-by: Michael Scott <[email protected]> Signed-off-by: Josua Mayer <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 05b9c7b commit 58aa832

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

net/bluetooth/6lowpan.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,16 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
187187
}
188188

189189
if (!rt) {
190-
nexthop = &lowpan_cb(skb)->gw;
191-
192-
if (ipv6_addr_any(nexthop))
193-
return NULL;
190+
if (ipv6_addr_any(&lowpan_cb(skb)->gw)) {
191+
/* There is neither route nor gateway,
192+
* probably the destination is a direct peer.
193+
*/
194+
nexthop = daddr;
195+
} else {
196+
/* There is a known gateway
197+
*/
198+
nexthop = &lowpan_cb(skb)->gw;
199+
}
194200
} else {
195201
nexthop = rt6_nexthop(rt, daddr);
196202

0 commit comments

Comments
 (0)