Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
@ 2026-11-27  5:45 Weihong Guan
  2026-11-27 13:53 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Weihong Guan @ 2026-11-27  5:45 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Kyle Pepper, Weihong Guan, Marcel Holtmann,
	Luiz Augusto von Dentz

A bonded peer using a resolvable private address is connected to by its
identity address only if its conn params carry
HCI_CONN_FLAG_ADDRESS_RESOLUTION. Without the flag,
hci_le_add_resolve_list_sync() leaves the peer's IRK out of the
controller's resolving list, but hci_le_add_accept_list_sync() still adds
its identity to the accept list, and the passive scan runs with filter
policy 0x01 and address resolution enabled. The controller has no IRK to
resolve the peer's RPA with, its advertising matches nothing, and the
connection never completes, though the kernel holds the IRK.

A plain connect makes such params: hci_explicit_conn_params_set() adds
them with no flags, so l2test, or bluetoothd's Device1.Connect for a
device it hasn't added to the kernel itself, waits forever.

Scan unfiltered for these peers too, as commit 397464709a20 ("Bluetooth:
hci_sync: scan unfiltered for host-resolved RPAs") does for a controller
without LL privacy: the host resolves the advertising and connects to the
RPA it found. The flag keeps its meaning, userspace's choice to have the
controller resolve.

Fixes: e209e5ccc5ac ("Bluetooth: MGMT: Mark LL Privacy as stable")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Weihong Guan <weihong.guan@gmail.com>
---
How it was found and tested: first seen on Linux 6.18 with a BL602 as the
peer, then reproduced on a Raspberry Pi 5 running 7.4-rc2 with
net/bluetooth from bluetooth-next, bluetoothd stopped (an empty MGMT Load
IRKs first, as bluetoothd does, so pairing asks for the peer's IRK).

Controllers: as the central, an nRF52840 dongle with Zephyr's hci_usb (LL
privacy, resolving list 8), and a WCH CH583 running our open HCI
controller firmware over USB (LL privacy, resolving list 8). As the
private peer, a CH583 or a CH571 running the same firmware's BLE 4.0
build (no address resolution, so its Linux makes the RPA in the host).

Steps: pair the central with the peer at its RPA (btmgmt pair, Just
Works); the peer moves to a new RPA; then
  l2test -n -i hciX -J 4 -V le_public -E <identity>

Without this patch (nRF52840 central here, and the BL602 bench's runs on
6.18): not connected in 15 s, resolv_list empty, the IRK in
identity_resolving_keys (the kernel saw the new RPA). With it: connected,
3 of 3 (nRF52840 central once, CH583 central twice), resolv_list still
empty: the host resolved the advertising. With the flag set (btmgmt
add-device -a 0, set-flags -f 4), the resolving list path, unchanged:
connected through the resolving list on the nRF52840.

Related, not overlapping: Radek Podgorny's "Bluetooth: find an RPA peer's
connection parameters by its identity" (v5) changes the connect path, on
a controller without LL privacy; Brandon Williams' "Bluetooth: hci_sync:
Reprogram the resolving list when a peer's IRK changes" handles a stale
entry, not a peer left out of the list.

 net/bluetooth/hci_sync.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index ee426ffea..7ca7676ae 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2893,8 +2893,13 @@ static int hci_le_add_accept_list_sync(struct hci_dev *hdev,
 		return 0;
 	}
 
-	/* Host-resolved peers need unfiltered scanning while awake. */
-	if (!force_filter && !hdev->suspended && !ll_privacy_capable(hdev) &&
+	/* Host-resolved peers need unfiltered scanning while awake: with no LL
+	 * privacy, or not marked for address resolution, which keeps them out
+	 * of the resolving list (hci_le_add_resolve_list_sync()).
+	 */
+	if (!force_filter && !hdev->suspended &&
+	    (!ll_privacy_capable(hdev) ||
+	     !(params->flags & HCI_CONN_FLAG_ADDRESS_RESOLUTION)) &&
 	    hci_find_irk_by_addr(hdev, &params->addr, params->addr_type))
 		return -EINVAL;
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-27 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  5:45 [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list Weihong Guan
2026-11-27 13:53 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox