2023-07-28 09:14:37

by Simon Mikuda

[permalink] [raw]
Subject: [PATCH BlueZ] 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.

Signed-off-by: Simon Mikuda <[email protected]>
---
src/advertising.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/advertising.c b/src/advertising.c
index d959bf38f..49861e1a2 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -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
--
2.34.1



2023-07-28 11:08:21

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] advertising: Fix peripheral adverts when Discoverable = false

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

2023-07-28 11:34:07

by Simon Mikuda

[permalink] [raw]
Subject: [PATCH BlueZ] 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(-)

diff --git a/src/advertising.c b/src/advertising.c
index d959bf38f..2c9a5a443 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -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
--
2.34.1


2023-07-28 13:19:50

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] advertising: Fix peripheral adverts when Discoverable = false

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

2023-07-28 23:28:49

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false

Hello:

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

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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html