2018-12-20 16:17:15

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: Advertising report address types in mesh-io-generic

Hi,

I've noticed that mesh-io-generic.c filters advertising report events by
address type:

static void event_adv_report(struct mesh_io *io, const void *buf, uint8_t size)
{
...

if (evt->addr_type != BDADDR_LE_PUBLIC &&
evt->addr_type != BDADDR_LE_RANDOM)
return;

Does anyone know why (Brian?)?

Bluetooth Mesh spec doesn't mention address types at all, so I assumed
that this layer shouldn't really care about MAC addresses and their
types.

--
Michał Lowas-Rzechonek <[email protected]>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND


2018-12-20 17:00:06

by Gix, Brian

[permalink] [raw]
Subject: RE: Advertising report address types in mesh-io-generic

Hi Michal,

> -----Original Message-----
> From: [email protected] [mailto:linux-bluetooth-
> [email protected]] On Behalf Of Michal Lowas-Rzechonek
> Sent: Thursday, December 20, 2018 8:17 AM
> To: [email protected]
> Subject: Advertising report address types in mesh-io-generic
>
> Hi,
>
> I've noticed that mesh-io-generic.c filters advertising report events by
> address type:
>
> static void event_adv_report(struct mesh_io *io, const void *buf, uint8_t
> size) {
> ...
>
> if (evt->addr_type != BDADDR_LE_PUBLIC &&
> evt->addr_type != BDADDR_LE_RANDOM)
> return;

Address types can be BR/EDR (0x00), LE Public (0x01), and LE Random (0x02).

This filters out BR/EDR advertisements, which are not supported in Mesh. (should be LE Only).

>
> Does anyone know why (Brian?)?
>
> Bluetooth Mesh spec doesn't mention address types at all, so I assumed that
> this layer shouldn't really care about MAC addresses and their types.
>
> --
> Michał Lowas-Rzechonek <[email protected]>
> Silvair http://silvair.com
> Jasnogórska 44, 31-358 Krakow, POLAND

2018-12-20 18:03:27

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: Re: Advertising report address types in mesh-io-generic

Brian,

Thanks for taking time to look into this.

On 12/20, Gix, Brian wrote:
> > if (evt->addr_type != BDADDR_LE_PUBLIC &&
> > evt->addr_type != BDADDR_LE_RANDOM)
> > return;
>
> Address types can be BR/EDR (0x00), LE Public (0x01), and LE Random (0x02).
>
> This filters out BR/EDR advertisements, which are not supported in Mesh. (should be LE Only).
Hmm. Correct me if I'm wrong, but the Bluetooth Core 5.0 spec,
Volume 2, part E, chapter 7.7.65.2 "LE Advertising Report Event", which
I believe we're dealing with, because of:

static bool dev_init(uint16_t index, struct mesh_io *io)
{
...
bt_hci_register(tmp->hci, BT_HCI_EVT_LE_META_EVENT,
event_callback, io, NULL);

and

static void event_callback(const void *buf, uint8_t size, void *user_data)
{
...
switch (event) {
case BT_HCI_EVT_LE_ADV_REPORT:
event_adv_report(io, buf + 1, size - 1);
break;

says that "address type" in that event is one of:

0x00 Public Device Address
0x01 Random Device Address
0x02 Public Identity Address (Corresponds to Resolved Private Address)
0x03 Random (static) Identity Address (Corresponds to Resolved Private
Address)

and nowhere does it mention BR/EDR.

I don't think we're supposed to even receive BR/EDR addresses via HCI LE
Meta Event.

cheers
--
Michał Lowas-Rzechonek <[email protected]>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND

2018-12-20 18:09:27

by Gix, Brian

[permalink] [raw]
Subject: RE: Advertising report address types in mesh-io-generic

Hi Michal,

> -----Original Message-----
> From: [email protected] [mailto:linux-bluetooth-
> [email protected]] On Behalf Of Michal Lowas-Rzechonek
> Sent: Thursday, December 20, 2018 10:03 AM
> To: [email protected]
> Subject: Re: Advertising report address types in mesh-io-generic
>
> Brian,
>
> Thanks for taking time to look into this.
>
> On 12/20, Gix, Brian wrote:
> > > if (evt->addr_type != BDADDR_LE_PUBLIC &&
> > > evt->addr_type != BDADDR_LE_RANDOM)
> > > return;
> >
> > Address types can be BR/EDR (0x00), LE Public (0x01), and LE Random
> (0x02).
> >
> > This filters out BR/EDR advertisements, which are not supported in Mesh.
> (should be LE Only).
> Hmm. Correct me if I'm wrong, but the Bluetooth Core 5.0 spec, Volume 2,
> part E, chapter 7.7.65.2 "LE Advertising Report Event", which I believe we're
> dealing with, because of:
>
> static bool dev_init(uint16_t index, struct mesh_io *io) {
> ...
> bt_hci_register(tmp->hci, BT_HCI_EVT_LE_META_EVENT,
> event_callback, io, NULL);
>
> and
>
> static void event_callback(const void *buf, uint8_t size, void *user_data) {
> ...
> switch (event) {
> case BT_HCI_EVT_LE_ADV_REPORT:
> event_adv_report(io, buf + 1, size - 1);
> break;
>
> says that "address type" in that event is one of:
>
> 0x00 Public Device Address
> 0x01 Random Device Address
> 0x02 Public Identity Address (Corresponds to Resolved Private Address)
> 0x03 Random (static) Identity Address (Corresponds to Resolved Private
> Address)
>
> and nowhere does it mention BR/EDR.
>
> I don't think we're supposed to even receive BR/EDR addresses via HCI LE
> Meta Event.

I think you are probably correct. This may be a remnant that we picked up from code that was
intended to serve both BR/EDR and LE advertisements. I will remove that check first thing after
the existing patchset is applied.


>
> cheers
> --
> Michał Lowas-Rzechonek <[email protected]>
> Silvair http://silvair.com
> Jasnogórska 44, 31-358 Krakow, POLAND

2018-12-20 18:19:12

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: Re: Advertising report address types in mesh-io-generic

On 12/20, Gix, Brian wrote:
> > says that "address type" in that event is one of:
> >
> > 0x00 Public Device Address
> > 0x01 Random Device Address
> > 0x02 Public Identity Address (Corresponds to Resolved Private Address)
> > 0x03 Random (static) Identity Address (Corresponds to Resolved Private
> > Address)
> >
> > and nowhere does it mention BR/EDR.
> >
> > I don't think we're supposed to even receive BR/EDR addresses via HCI LE
> > Meta Event.
>
> I think you are probably correct. This may be a remnant that we picked up from code that was
> intended to serve both BR/EDR and LE advertisements. I will remove that check first thing after
> the existing patchset is applied.
Thanks! \o/

Thanks for the work by the way, we're still digging into the codebase
and getting our heads around it, but I'll make sure to give you folks a
hand when we finally manage to add something substantial.

cheers
--
Michał Lowas-Rzechonek <[email protected]>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND