linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false
@ 2023-07-28  8:57 Simon Mikuda
  2023-07-28 10:25 ` [BlueZ] " bluez.test.bot
  2023-07-28 10:56 ` [PATCH BlueZ] " Simon Mikuda
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Mikuda @ 2023-07-28  8:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: 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.

Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [BlueZ] advertising: Fix peripheral adverts when Discoverable = false
  2023-07-28  8:57 [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false Simon Mikuda
@ 2023-07-28 10:25 ` bluez.test.bot
  2023-07-28 10:56 ` [PATCH BlueZ] " Simon Mikuda
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-07-28 10:25 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false
  2023-07-28  8:57 [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false Simon Mikuda
  2023-07-28 10:25 ` [BlueZ] " bluez.test.bot
@ 2023-07-28 10:56 ` Simon Mikuda
  2023-07-28 12:19   ` [BlueZ] " bluez.test.bot
  2023-07-28 22:50   ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 2 replies; 5+ messages in thread
From: Simon Mikuda @ 2023-07-28 10:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: 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(-)

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [BlueZ] advertising: Fix peripheral adverts when Discoverable = false
  2023-07-28 10:56 ` [PATCH BlueZ] " Simon Mikuda
@ 2023-07-28 12:19   ` bluez.test.bot
  2023-07-28 22:50   ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-07-28 12:19 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false
  2023-07-28 10:56 ` [PATCH BlueZ] " Simon Mikuda
  2023-07-28 12:19   ` [BlueZ] " bluez.test.bot
@ 2023-07-28 22:50   ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2023-07-28 22:50 UTC (permalink / raw)
  To: Simon Mikuda; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-28 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  8:57 [PATCH BlueZ] advertising: Fix peripheral adverts when Discoverable = false Simon Mikuda
2023-07-28 10:25 ` [BlueZ] " bluez.test.bot
2023-07-28 10:56 ` [PATCH BlueZ] " Simon Mikuda
2023-07-28 12:19   ` [BlueZ] " bluez.test.bot
2023-07-28 22:50   ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).