Linux bluetooth development
 help / color / mirror / Atom feed
From: Weihong Guan <weihong.guan@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Weihong Guan <weihong.guan@gmail.com>,
	linux-bluetooth@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>,
	Kyle Pepper <cochcoder@proton.me>
Subject: Re: [PATCH] Bluetooth: hci_sync: Unfiltered scan for peers outside resolving list
Date: Sat, 28 Nov 2026 02:18:44 +0000	[thread overview]
Message-ID: <20261128021848.3616395-1-weihong.guan@gmail.com> (raw)
In-Reply-To: <CABBYNZLOCfG449tJUnAGjN=PvLVFy4Vj=bgvSCMeFEQbnudA_g@mail.gmail.com>

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

  reply	other threads:[~2026-11-28  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2026-12-04  4:08       ` Weihong Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128021848.3616395-1-weihong.guan@gmail.com \
    --to=weihong.guan@gmail.com \
    --cc=cochcoder@proton.me \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox