From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>,
Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: [PATCH] Bluetooth: hci_sync: Don't announce a broadcast from an NRPA
Date: Sun, 22 Nov 2026 21:09:35 +0100 [thread overview]
Message-ID: <20261122200935.2778839-1-simon.mikuda@streamunlimited.com> (raw)
A source registered over MGMT becomes periodic only when its PA starts, so
until then it advertises from a non-resolvable private address without a
PA, and from another address once the PA starts. Scanners list it twice,
and an assistant that picks the first entry can never sync:
broadcast [1] 7C:A3:38:7A:00:38 Broadcast ID EAE7E6
broadcast [2] 50:1E:2D:9E:E7:92 Broadcast ID EAE7E6
Treat a set with a Broadcast Audio Announcement as a broadcast set too, and
set it up again once its data is known.
Fixes: 03ddb4ac2514 ("Bluetooth: hci_sync: Fix using random address for BIG/PA advertisements")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
net/bluetooth/hci_sync.c | 12 ++++++++++--
net/bluetooth/mgmt.c | 14 ++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 638589f77081..c7533cc94ec1 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1483,7 +1483,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
{
struct hci_cp_le_set_ext_adv_params cp;
struct hci_rp_le_set_ext_adv_params rp;
- bool connectable, require_privacy;
+ bool connectable, periodic, require_privacy;
u32 flags;
bdaddr_t random_addr;
u8 own_addr_type;
@@ -1518,6 +1518,14 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
flags = hci_adv_instance_flags(hdev, instance);
+ /* A set with a Broadcast Audio Announcement is a broadcast source even
+ * before its PA starts.
+ */
+ periodic = adv && (adv->periodic ||
+ eir_get_service_data(adv->adv_data,
+ adv->adv_data_len, 0x1852,
+ NULL));
+
/* If the "connectable" instance flag was not set, then choose between
* ADV_IND and ADV_NONCONN_IND based on the global connectable setting.
*/
@@ -1534,7 +1542,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
* advertising is used and it is not periodic.
* In that case it is fine to use a non-resolvable private address.
*/
- require_privacy = !connectable && !(adv && adv->periodic);
+ require_privacy = !connectable && !periodic;
err = hci_get_random_address(hdev, require_privacy,
adv_use_rpa(hdev, flags), adv,
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f5f32860782d..edfbdf2942f7 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -9646,6 +9646,20 @@ static int add_ext_adv_data_sync(struct hci_dev *hdev, void *data)
int err;
if (ext_adv_capable(hdev)) {
+ struct adv_info *adv;
+ bool bcast;
+
+ /* The parameters were set before the data was known */
+ hci_dev_lock(hdev);
+ adv = hci_find_adv_instance(hdev, cp->instance);
+ bcast = adv && !adv->periodic &&
+ eir_get_service_data(adv->adv_data, adv->adv_data_len,
+ 0x1852, NULL);
+ hci_dev_unlock(hdev);
+
+ if (bcast)
+ return hci_start_ext_adv_sync(hdev, cp->instance);
+
err = hci_update_adv_data_sync(hdev, cp->instance);
if (err)
return err;
base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
--
2.43.0
next reply other threads:[~2026-11-22 20:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 20:09 Simon Mikuda [this message]
2026-11-22 22:55 ` Bluetooth: hci_sync: Don't announce a broadcast from an NRPA bluez.test.bot
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=20261122200935.2778839-1-simon.mikuda@streamunlimited.com \
--to=simon.mikuda@streamunlimited.com \
--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