All of lore.kernel.org
 help / color / mirror / Atom feed
* Double flags field in LE advertising data
@ 2019-06-20  9:51 Thiemo van Engelen
  2019-06-21 17:12 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Thiemo van Engelen @ 2019-06-20  9:51 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

We have an embedded device with Bluez 5.50, kernel 4.19 and a bluetooth
controller where we disable br/edr.
When we start an LE advertisement and set the Discoverable property (of
the advertisment, not the adapter) to True, the advertised packet
contains 2 flag fields, containing different values. See the following
btmon log of the device:

< HCI Command: LE Set Advertising Data (0x08|0x0008) plen
32                                                                     
                                                                       
             #211 [hci0] 1656.561908
        Length: 24
        Flags: 0x04
          BR/EDR Not Supported
        128-bit Service UUIDs (complete): 1 entry
          Vendor specific (cd54c001-880b-425b-b167-81ed6a15e913)
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported

This is not allowed according to the "Supplement to Bluetooth Core
Specification" and the fact that both fields are different seems to
confuse other devices.

The flags are added twice because bluetoothd appends a flags field in
the parse_discoverable / set_flags functions (since commit eca59ac27),
but the kernel also adds a flags field in the function
create_instance_adv_data when BREDR is disabled. 

Perhaps the way to solve this is by not adding the flags field to the
advertisement data, but changing client->flags in accordance with the
Discoverable property and passing that to the kernel using the
mgmt_cp_add_advertising struct (which is already done). The kernel is
then solely responsible for flags. I however have no idea if the flags
passed this way are also used used for BREDR advertising or not.

Kind Regards,

Thiemo van Engelen


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

* Re: Double flags field in LE advertising data
  2019-06-20  9:51 Double flags field in LE advertising data Thiemo van Engelen
@ 2019-06-21 17:12 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-06-21 17:12 UTC (permalink / raw)
  To: Thiemo van Engelen; +Cc: linux-bluetooth

Hi Thiemo,

On Thu, Jun 20, 2019 at 12:53 PM Thiemo van Engelen
<tvanengelen@victronenergy.com> wrote:
>
> Hi,
>
> We have an embedded device with Bluez 5.50, kernel 4.19 and a bluetooth
> controller where we disable br/edr.
> When we start an LE advertisement and set the Discoverable property (of
> the advertisment, not the adapter) to True, the advertised packet
> contains 2 flag fields, containing different values. See the following
> btmon log of the device:
>
> < HCI Command: LE Set Advertising Data (0x08|0x0008) plen
> 32
>
>              #211 [hci0] 1656.561908
>         Length: 24
>         Flags: 0x04
>           BR/EDR Not Supported
>         128-bit Service UUIDs (complete): 1 entry
>           Vendor specific (cd54c001-880b-425b-b167-81ed6a15e913)
>         Flags: 0x06
>           LE General Discoverable Mode
>           BR/EDR Not Supported
>
> This is not allowed according to the "Supplement to Bluetooth Core
> Specification" and the fact that both fields are different seems to
> confuse other devices.
>
> The flags are added twice because bluetoothd appends a flags field in
> the parse_discoverable / set_flags functions (since commit eca59ac27),
> but the kernel also adds a flags field in the function
> create_instance_adv_data when BREDR is disabled.

Interesting I guess that is a problem only when BR/EDR is disabled
since I tested this and the kernel would be adding any flags, anyway
the kernel should check if the flags have been set and don't attempt
to set it again.

> Perhaps the way to solve this is by not adding the flags field to the
> advertisement data, but changing client->flags in accordance with the
> Discoverable property and passing that to the kernel using the
> mgmt_cp_add_advertising struct (which is already done). The kernel is
> then solely responsible for flags. I however have no idea if the flags
> passed this way are also used used for BREDR advertising or not.
>
> Kind Regards,
>
> Thiemo van Engelen
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2019-06-21 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20  9:51 Double flags field in LE advertising data Thiemo van Engelen
2019-06-21 17:12 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.