* [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
2026-11-27 16:46 ` [PATCH] " Weihong Guan
0 siblings, 2 replies; 5+ 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, ¶ms->addr, params->addr_type))
return -EINVAL;
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
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
2026-11-27 16:46 ` [PATCH] " Weihong Guan
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-11-27 13:53 UTC (permalink / raw)
To: linux-bluetooth, weihong.guan
[-- Attachment #1: Type: text/plain, Size: 2964 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1223969/
---Test result---
Test Summary:
CheckPatch FAIL 0.52 seconds
VerifyFixes PASS 0.09 seconds
VerifySignedoff PASS 0.09 seconds
GitLint PASS 0.24 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 18.06 seconds
CheckAllWarning PASS 20.93 seconds
CheckSparse PASS 22.39 seconds
BuildKernel32 PASS 18.21 seconds
CheckKernelLLVM PASS 18.45 seconds
TestRunnerSetup PASS 413.90 seconds
TestRunner_l2cap-tester PASS 14.45 seconds
TestRunner_iso-tester PASS 10.33 seconds
TestRunner_bnep-tester PASS 2.83 seconds
TestRunner_mgmt-tester FAIL 86.29 seconds
TestRunner_rfcomm-tester PASS 3.99 seconds
TestRunner_sco-tester PASS 4.95 seconds
TestRunner_ioctl-tester PASS 4.02 seconds
TestRunner_mesh-tester PASS 3.94 seconds
TestRunner_smp-tester PASS 3.87 seconds
TestRunner_userchan-tester PASS 2.79 seconds
TestRunner_6lowpan-tester PASS 3.93 seconds
IncrementalBuild PASS 17.20 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
WARNING: Non-standard signature: Assisted-by:
#139:
Assisted-by: Claude:claude-opus-5.5
ERROR: Unrecognized email address: 'Claude:claude-opus-5.5'
#139:
Assisted-by: Claude:claude-opus-5.5
total: 1 errors, 1 warnings, 0 checks, 15 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluetooth-next/bluetooth-next/src/patch/15028060.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 529, Passed: 525 (99.2%), Failed: 4, Not Run: 0
Failed Test Cases
LL Privacy - Scan RPA - Auto-connect with IRK Failed 0.016 seconds
LL Privacy - Scan RPA - Background report with IRK Failed 0.016 seconds
LL Privacy - Add Device 2 (2 Devices to AL) Timed out 2.006 seconds
LL Privacy - Add Device 3 (AL is full) Timed out 2.008 seconds
https://github.com/bluez/bluetooth-next/pull/1238
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
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
@ 2026-11-27 16:46 ` Weihong Guan
2026-11-27 17:10 ` Luiz Augusto von Dentz
1 sibling, 1 reply; 5+ messages in thread
From: Weihong Guan @ 2026-11-27 16:46 UTC (permalink / raw)
To: linux-bluetooth
Cc: Weihong Guan, Luiz Augusto von Dentz, Marcel Holtmann,
Kyle Pepper
Hi Luiz,
The CI's mgmt-tester fails four LL Privacy cases with this patch:
LL Privacy - Scan RPA - Auto-connect with IRK
LL Privacy - Scan RPA - Background report with IRK
LL Privacy - Add Device 2 (2 Devices to AL)
LL Privacy - Add Device 3 (AL is full)
They fail as designed, not by accident. Your BlueZ commit fa6ba55020
("mgmt-tester: Add LL Privacy host-resolved RPA scan checks") expects a
peer with an IRK, added without HCI_CONN_FLAG_ADDRESS_RESOLUTION, to stay
in the accept list with filter policy 0x01, "since the controller
resolves RPAs". The patch changes exactly that case, so I would like to
ask which way you prefer before sending a v2.
What I see on hardware: without the flag, hci_le_add_resolve_list_sync()
returns early, so the peer's IRK never reaches the controller's resolving
list. The controller then cannot resolve the peer's RPA, and the accept
list holds only its identity address, so every advertisement from the RPA
is filtered out. A connect by identity to a bonded private peer never
completes (no connection in 15 s, resolv_list empty), on an nRF52840
(Zephyr hci_usb) and on a WCH CH583 running our open controller, as in
the patch's notes. With the flag set, the resolving list path works.
Two ways I can see:
1. Keep this patch (an unflagged peer with an IRK is scanned unfiltered
and resolved by the host, as on a controller without LL privacy), and
I send a BlueZ patch updating the four cases to expect that.
2. Leave the scan filtered, and instead put a peer with an IRK into the
resolving list on an LL privacy controller even without the flag, so
the accept list matches its resolved identity. That keeps these tests
as they are, but changes what the flag means, and the Set Device
Flags cases may need a look.
Is either of these what you had in mind, or is the flag meant to always
be set by userspace for such peers, making the unflagged case unsupported?
Thanks,
Weihong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
2026-11-27 16:46 ` [PATCH] " Weihong Guan
@ 2026-11-27 17:10 ` Luiz Augusto von Dentz
2026-11-28 2:18 ` Weihong Guan
0 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2026-11-27 17:10 UTC (permalink / raw)
To: Weihong Guan; +Cc: linux-bluetooth, Marcel Holtmann, Kyle Pepper
Hi,
On Fri, Nov 27, 2026 at 11:47 AM Weihong Guan <weihong.guan@gmail.com> wrote:
>
> Hi Luiz,
>
> The CI's mgmt-tester fails four LL Privacy cases with this patch:
>
> LL Privacy - Scan RPA - Auto-connect with IRK
> LL Privacy - Scan RPA - Background report with IRK
> LL Privacy - Add Device 2 (2 Devices to AL)
> LL Privacy - Add Device 3 (AL is full)
>
> They fail as designed, not by accident. Your BlueZ commit fa6ba55020
> ("mgmt-tester: Add LL Privacy host-resolved RPA scan checks") expects a
> peer with an IRK, added without HCI_CONN_FLAG_ADDRESS_RESOLUTION, to stay
> in the accept list with filter policy 0x01, "since the controller
> resolves RPAs". The patch changes exactly that case, so I would like to
> ask which way you prefer before sending a v2.
>
> What I see on hardware: without the flag, hci_le_add_resolve_list_sync()
> returns early, so the peer's IRK never reaches the controller's resolving
> list. The controller then cannot resolve the peer's RPA, and the accept
> list holds only its identity address, so every advertisement from the RPA
> is filtered out. A connect by identity to a bonded private peer never
> completes (no connection in 15 s, resolv_list empty), on an nRF52840
> (Zephyr hci_usb) and on a WCH CH583 running our open controller, as in
> the patch's notes. With the flag set, the resolving list path works.
>
> Two ways I can see:
>
> 1. Keep this patch (an unflagged peer with an IRK is scanned unfiltered
> and resolved by the host, as on a controller without LL privacy), and
> I send a BlueZ patch updating the four cases to expect that.
>
> 2. Leave the scan filtered, and instead put a peer with an IRK into the
> resolving list on an LL privacy controller even without the flag, so
> the accept list matches its resolved identity. That keeps these tests
> as they are, but changes what the flag means, and the Set Device
> Flags cases may need a look.
>
> Is either of these what you had in mind, or is the flag meant to always
> be set by userspace for such peers, making the unflagged case unsupported?
Something is off here, afaik that flag shall always be set if LL
Privacy is supported. If it is not then the resolving list shall not
be used at all so the controller shouldn't be attempting to resolve
anything.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
2026-11-27 17:10 ` Luiz Augusto von Dentz
@ 2026-11-28 2:18 ` Weihong Guan
0 siblings, 0 replies; 5+ messages in thread
From: Weihong Guan @ 2026-11-28 2:18 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: Weihong Guan, linux-bluetooth, Marcel Holtmann, Kyle Pepper
Hi Luiz,
On Fri, Nov 27, 2026 at 12:10 PM Luiz Augusto von Dentz wrote:
> Something is off here, afaik that flag shall always be set if LL
> Privacy is supported. If it is not then the resolving list shall not
> be used at all so the controller shouldn't be attempting to resolve
> anything.
Agreed, and I think this is where it is off: the params the kernel
creates itself for an explicit connect never get the flag.
The case first seen (a BL602 as the private peer, Linux 6.18 and BlueZ
5.88, bluetoothd running): Device1.Connect to a bonded device that
bluetoothd has not added to the kernel's connect list. bluetoothd sets the
flag on the devices it adds (since "device: Fix privacy", 5.85), but this
connect goes hci_connect_le_scan() -> hci_explicit_conn_params_set() ->
hci_conn_params_add(), whose params are zero-allocated: flags 0, on a
controller with LL privacy. l2test by identity takes the same path. The
peer's IRK then stays out of the resolving list, as you say it should
without the flag, while the identity still goes to the accept list and
the scan is filtered, so the controller drops every advertisement from
the peer's RPA and the connect never completes. Setting the flag by hand
(btmgmt set-flags 0x4) makes it connect, on an nRF52840 and on a CH583.
So instead of this patch, a v2 could set the flag where the kernel makes
those params, when the controller supports it, in
hci_explicit_conn_params_set():
params->auto_connect = HCI_AUTO_CONN_EXPLICIT;
params->flags |= hdev->conn_flags & HCI_CONN_FLAG_ADDRESS_RESOLUTION;
That leaves the accept-list scan as your mgmt-tester cases expect (they
go through Add Device), and userspace's choice on the devices it adds
untouched.
Tested on a Raspberry Pi 5 (7.4-rc2 with bluetooth-next's
net/bluetooth), an nRF52840 (Zephyr hci_usb, LL privacy) as the central
and a CH583 making its RPAs in the host as the peer, each run from a
freshly loaded stack: without the change, l2test by identity not
connected in 15 s, 2 of 2, resolv_list empty; with it, connected, 3 of
3, the identity in resolv_list, so the controller resolved the RPA.
With the flag set by hand (btmgmt set-flags 0x4) both connect.
Would that be the right place, or would you rather have
hci_conn_params_add() set it for every new entry? If this is it, I'll
send it as v2 in place of the unfiltered scan.
Thanks,
Weihong
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-28 2:18 UTC | newest]
Thread overview: 5+ 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
2026-11-27 16:46 ` [PATCH] " Weihong Guan
2026-11-27 17:10 ` Luiz Augusto von Dentz
2026-11-28 2:18 ` Weihong Guan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.