From: Simon Mikuda Date: Fri, 28 Jul 2023 10:56:04 +0000 (+0200) Subject: advertising: Fix peripheral adverts when Discoverable = false X-Git-Tag: accepted/tizen/unified/20240117.163238~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf438bd039589686ea0d7cac0ce3615306bc2375;p=platform%2Fupstream%2Fbluez.git 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. --- diff --git a/src/advertising.c b/src/advertising.c index 496aa0e..b7508e0 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -722,11 +722,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; @@ -1442,7 +1437,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