diff mbox series

[BlueZ] advertising: Fix peripheral adverts when Discoverable = false

Message ID 20230728085713.683655-1-simon.mikuda@streamunlimited.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ] advertising: Fix peripheral adverts when Discoverable = false | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Simon Mikuda July 28, 2023, 8:57 a.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com July 28, 2023, 10:25 a.m. UTC | #1
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
diff mbox series

Patch

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