diff mbox series

[BlueZ] Fix for broadcast mode, not to add any AD flags in advertise Data

Message ID 20241120144918.11991-1-quic_prathm@quicinc.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ] Fix for broadcast mode, not to add any AD flags in advertise Data | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
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/ScanBuild success Scan Build PASS

Commit Message

Prathibha Madugonde Nov. 20, 2024, 2:49 p.m. UTC
From: Prathibha Madugonde <quic_prathm@quicinc.com>

src/advertising.c
Include check for broadcast mode:
Need not set flags in AD flags of Advertise Data

Test steps:
From DUT, bluetoothctl go to menu advertise
secondary 1M/2M
name on
back
advertise broadcast

---
 src/advertising.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Luiz Augusto von Dentz Nov. 20, 2024, 3:13 p.m. UTC | #1
Hi,

On Wed, Nov 20, 2024 at 10:00 AM <quic_prathm@quicinc.com> wrote:
>
> From: Prathibha Madugonde <quic_prathm@quicinc.com>
>
> src/advertising.c
> Include check for broadcast mode:
> Need not set flags in AD flags of Advertise Data

Please reword the last sentence to something like: "AD flags shall
never be set for broadcast", also add traces showing what is
happening.

> Test steps:
> From DUT, bluetoothctl go to menu advertise
> secondary 1M/2M
> name on
> back
> advertise broadcast

In case you don't know it, it is possible to call command from
submenus directly:

advertise.secondary 1M/2M
advertise.name on
advertise broadcast

> ---
>  src/advertising.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/advertising.c b/src/advertising.c
> index bd121e525..2fc6f917d 100644
> --- a/src/advertising.c
> +++ b/src/advertising.c
> @@ -759,10 +759,15 @@ static bool parse_discoverable(DBusMessageIter *iter,
>
>         dbus_message_iter_get_basic(iter, &discoverable);
>
> +       /* For broadcast mode, need not add any flags
> +        * just return true without adding flags.
> +        */
>         if (discoverable)
>                 flags = BT_AD_FLAG_GENERAL;
> -       else
> +       else if (client->type != AD_TYPE_BROADCAST)
>                 flags = 0x00;
> +       else
> +               return true;
>
>         if (!set_flags(client , flags))
>                 goto fail;
> --
> 2.17.1
>
>
Prathibha Madugonde Nov. 20, 2024, 3:47 p.m. UTC | #2
On 11/20/2024 8:43 PM, Luiz Augusto von Dentz wrote:
> Hi,
> 
> On Wed, Nov 20, 2024 at 10:00 AM <quic_prathm@quicinc.com> wrote:
>>
>> From: Prathibha Madugonde <quic_prathm@quicinc.com>
>>
>> src/advertising.c
>> Include check for broadcast mode:
>> Need not set flags in AD flags of Advertise Data
> 
> Please reword the last sentence to something like: "AD flags shall
> never be set for broadcast", also add traces showing what is
> happening.
> 
Thanks Luiz for the input, re-framing the sentence and sending in 
upcoming patch.

Below is the snippet of btmon logs for advertise broadcast failure.

*****************************
@ MGMT Command: Add Extended Advertising Data (0x0055) plen 22 
 
                          {0x0001} [hci0] 160.010453
         Instance: 1
         Advertising data length: 3
         Flags: 0x04
           BR/EDR Not Supported
         Scan response length: 8
         Name (complete): prathm
@ MGMT Event: Advertising Added (0x0023) plen 1 
 
                          {0x0002} [hci0] 160.010474
         Instance: 1
 > HCI Event: Command Complete (0x0e) plen 4 
 
                                #46 [hci0] 160.010849
       LE Set Extended Advertising Data (0x08|0x0037) ncmd 2
         Status: Invalid HCI Command Parameters (0x12)
*******************************

>> Test steps:
>>  From DUT, bluetoothctl go to menu advertise
>> secondary 1M/2M
>> name on
>> back
>> advertise broadcast
> 
> In case you don't know it, it is possible to call command from
> submenus directly:
> 
> advertise.secondary 1M/2M
> advertise.name on
> advertise broadcast
> 

Got it. Thank you for info.

Thanks
Prathibha

>> ---
>>   src/advertising.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/advertising.c b/src/advertising.c
>> index bd121e525..2fc6f917d 100644
>> --- a/src/advertising.c
>> +++ b/src/advertising.c
>> @@ -759,10 +759,15 @@ static bool parse_discoverable(DBusMessageIter *iter,
>>
>>          dbus_message_iter_get_basic(iter, &discoverable);
>>
>> +       /* For broadcast mode, need not add any flags
>> +        * just return true without adding flags.
>> +        */
>>          if (discoverable)
>>                  flags = BT_AD_FLAG_GENERAL;
>> -       else
>> +       else if (client->type != AD_TYPE_BROADCAST)
>>                  flags = 0x00;
>> +       else
>> +               return true;
>>
>>          if (!set_flags(client , flags))
>>                  goto fail;
>> --
>> 2.17.1
>>
>>
> 
>
bluez.test.bot@gmail.com Nov. 20, 2024, 4:15 p.m. UTC | #3
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=911300

---Test result---

Test Summary:
CheckPatch                    PENDING   0.16 seconds
GitLint                       PENDING   0.26 seconds
BuildEll                      PASS      20.47 seconds
BluezMake                     PASS      1738.71 seconds
MakeCheck                     PASS      13.48 seconds
MakeDistcheck                 PASS      162.46 seconds
CheckValgrind                 PASS      217.29 seconds
CheckSmatch                   PASS      276.36 seconds
bluezmakeextell               PASS      101.82 seconds
IncrementalBuild              PENDING   0.37 seconds
ScanBuild                     PASS      865.73 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/advertising.c b/src/advertising.c
index bd121e525..2fc6f917d 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -759,10 +759,15 @@  static bool parse_discoverable(DBusMessageIter *iter,
 
 	dbus_message_iter_get_basic(iter, &discoverable);
 
+	/* For broadcast mode, need not add any flags
+	 * just return true without adding flags.
+	 */
 	if (discoverable)
 		flags = BT_AD_FLAG_GENERAL;
-	else
+	else if (client->type != AD_TYPE_BROADCAST)
 		flags = 0x00;
+	else
+		return true;
 
 	if (!set_flags(client , flags))
 		goto fail;