Skip to contentSkip to conversation

Bluetooth: hci_sync: Don't announce a broadcast from an NRPA

PATCH In review Simon Mikuda 2 participants 2 messages Nov 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: Don't announce a broadcast from an NRPA

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")
---
 net/bluetooth/hci_sync.c | 12 ++++++++++--
 net/bluetooth/mgmt.c     | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
net/bluetooth/hci_sync.c +10 -2
index 638589f77081..c7533cc94ec1 100644
@@ -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,
net/bluetooth/mgmt.c +14 -0
index f5f32860782d..edfbdf2942f7 100644
@@ -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

Signature · 1 line
2.43.0
#1 lore raw

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/1218945/

---Test result---

Test Summary:

CheckPatch                    PASS      1.05 seconds
VerifyFixes                   PASS      0.13 seconds
VerifySignedoff               PASS      0.13 seconds
GitLint                       PASS      0.35 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      31.95 seconds
CheckAllWarning               PASS      36.23 seconds
CheckSparse                   PASS      39.00 seconds
BuildKernel32                 PASS      31.43 seconds
CheckKernelLLVM               PASS      34.48 seconds
TestRunnerSetup               PASS      769.34 seconds
TestRunner_l2cap-tester       PASS      15.17 seconds
TestRunner_iso-tester         PASS      13.45 seconds
TestRunner_bnep-tester        PASS      3.26 seconds
TestRunner_mgmt-tester        PASS      89.69 seconds
TestRunner_rfcomm-tester      PASS      4.67 seconds
TestRunner_sco-tester         PASS      5.71 seconds
TestRunner_ioctl-tester       PASS      4.75 seconds
TestRunner_mesh-tester        PASS      4.57 seconds
TestRunner_smp-tester         PASS      4.43 seconds
TestRunner_userchan-tester    PASS      3.30 seconds
TestRunner_6lowpan-tester     PASS      4.51 seconds
IncrementalBuild              PASS      29.91 seconds

https://github.com/bluez/bluetooth-next/pull/1190

---
Regards,
Linux Bluetooth