Skip to contentSkip to conversation

advertising: Fix peripheral adverts when Discoverable = false

PATCH In review Simon Mikuda 3 participants 5 messages Jul 28, 2023 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 advertising: Fix peripheral adverts when Discoverable = false

There is a problem with this configuration: Type = peripheral, Discoverable = false and Adapter is discoverable

In this state device will start advertise discoverable advertisements even when user wanted non-discoverable advertisements.

This change will add empty Flags when "Discoverable" parameter is set.

---
 src/advertising.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
src/advertising.c +2 -6
index d959bf38f..49861e1a2 100644
@@ -727,11 +727,6 @@ fail:
 
 static bool set_flags(struct btd_adv_client *client, uint8_t flags)
 {
-	if (!flags) {
-		bt_ad_clear_flags(client->data);
-		return true;
-	}
-
 	/* Set BR/EDR Not Supported for LE only */
 	if (!btd_adapter_get_bredr(client->manager->adapter))
 		flags |= BT_AD_FLAG_NO_BREDR;
@@ -1447,7 +1442,8 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
 		}
 	}
 
-	if (bt_ad_has_flags(client->data)) {
+	if (bt_ad_get_flags(client->data) &
+			(BT_AD_FLAG_GENERAL | BT_AD_FLAG_GENERAL)) {
 		/* BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part C
 		 * page 2042:
 		 * A device in the broadcast mode shall not set the
Signature · 1 line
2.34.1
#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/project/bluetooth/list/?series=770478

---Test result---

Test Summary:

CheckPatch                    PASS      0.44 seconds
GitLint                       PASS      0.30 seconds
BuildEll                      PASS      35.46 seconds
BluezMake                     PASS      1077.40 seconds
MakeCheck                     PASS      12.44 seconds
MakeDistcheck                 PASS      183.39 seconds
CheckValgrind                 PASS      296.96 seconds
CheckSmatch                   PASS      407.05 seconds
bluezmakeextell               PASS      121.52 seconds
IncrementalBuild              PASS      958.51 seconds
ScanBuild                     PASS      1241.02 seconds

---
Regards,
Linux Bluetooth

#2 lore raw

PATCH 1/1 advertising: Fix peripheral adverts when Discoverable = false

In reply to Simon Mikuda

There is a problem with this configuration: Type = peripheral, Discoverable = false and Adapter is discoverable

In this state device will start advertise discoverable advertisements even when user wanted non-discoverable advertisements.

This change will add empty Flags when "Discoverable" parameter is set.

---
 src/advertising.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
src/advertising.c +2 -6
index d959bf38f..2c9a5a443 100644
@@ -727,11 +727,6 @@ fail:
 
 static bool set_flags(struct btd_adv_client *client, uint8_t flags)
 {
-	if (!flags) {
-		bt_ad_clear_flags(client->data);
-		return true;
-	}
-
 	/* Set BR/EDR Not Supported for LE only */
 	if (!btd_adapter_get_bredr(client->manager->adapter))
 		flags |= BT_AD_FLAG_NO_BREDR;
@@ -1447,7 +1442,8 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
 		}
 	}
 
-	if (bt_ad_has_flags(client->data)) {
+	if (bt_ad_get_flags(client->data) &
+			(BT_AD_FLAG_GENERAL | BT_AD_FLAG_LIMITED)) {
 		/* BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part C
 		 * page 2042:
 		 * A device in the broadcast mode shall not set the
Signature · 1 line
2.34.1
#3 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/project/bluetooth/list/?series=770527

---Test result---

Test Summary:

CheckPatch                    PASS      0.53 seconds
GitLint                       PASS      0.37 seconds
BuildEll                      PASS      32.33 seconds
BluezMake                     PASS      967.12 seconds
MakeCheck                     PASS      13.52 seconds
MakeDistcheck                 PASS      184.18 seconds
CheckValgrind                 PASS      303.51 seconds
CheckSmatch                   PASS      401.78 seconds
bluezmakeextell               PASS      122.84 seconds
IncrementalBuild              PASS      791.91 seconds
ScanBuild                     PASS      1251.06 seconds

---
Regards,
Linux Bluetooth

#4 lore raw
In reply to Simon Mikuda
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Fri, 28 Jul 2023 12:56:04 +0200 you wrote:

There is a problem with this configuration: Type = peripheral, Discoverable = false and Adapter is discoverable

In this state device will start advertise discoverable advertisements even when user wanted non-discoverable advertisements.

This change will add empty Flags when "Discoverable" parameter is set.

[...]

Here is the summary with links:
- [BlueZ] advertising: Fix peripheral adverts when Discoverable = false

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=828bc564e6e8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html