Page MenuHomeFreeBSD

Make cached Bluetooth LE host advertise information visible from userland.
ClosedPublic

Authored by takawata on Apr 11 2017, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 4:33 PM
Unknown Object (File)
Wed, Dec 11, 4:37 AM
Unknown Object (File)
Fri, Nov 29, 6:13 PM
Unknown Object (File)
Oct 10 2024, 12:54 PM
Unknown Object (File)
Sep 24 2024, 6:03 PM
Unknown Object (File)
Sep 24 2024, 6:03 PM
Unknown Object (File)
Sep 19 2024, 11:59 PM
Unknown Object (File)
Sep 14 2024, 7:35 AM
Subscribers

Details

Summary

In read_neighbor_cache sub command of hccontrol, there is no information on address type. And bluetooth LE advertise contains extended inquiry and RSSI.

This diff exports these information for user land and make hccontrol recognize them.

Test Plan

Prepare bluetooth LE device and
%hccontrol le_set_scan_enable enable
% hccontrol read_neighbor_cache
and view result.

Diff Detail

Event Timeline

emax requested changes to this revision.Apr 12 2017, 6:12 PM

can you please add boundary checks? thanks!

sys/netgraph/bluetooth/hci/ng_hci_evnt.c
438

do we need to make sure that mbuf really has n->extinq_data bytes available? what if actual data size is less than header says?

usr.sbin/bluetooth/hccontrol/node.c
234

do we need to check elemlen here as well? basically what if elemlen is longer than supplied length?

291

i think this is off by one, i.e. sizeof() will return 4, but last index is 3. what do you think?

This revision now requires changes to proceed.Apr 12 2017, 6:12 PM
takawata edited edge metadata.

add NULL pointer checks pointed out.

emax requested changes to this revision.Apr 18 2017, 8:56 PM

please see my comments above. thanks!

sys/netgraph/bluetooth/hci/ng_hci_evnt.c
439

NG_HCI_M_PULLUP() alerts on result being NULL already. also, i think, we still need to check if mbuf actually has enough data.

448

same comment as above, i.e. NG_HCI_M_PULLUP() warns, and, please check length to make sure data are present

This revision now requires changes to proceed.Apr 18 2017, 8:56 PM
takawata added inline comments.
sys/netgraph/bluetooth/hci/ng_hci_evnt.c
439

Ok. I'll simply use m_pullup instead.

takawata edited edge metadata.

Use m_pullup instead of NG_HCI_M_PULLUP, if mbuf has enough space, m_pullup will return NULL.

This revision is now accepted and ready to land.Apr 24 2017, 7:33 PM
This revision was automatically updated to reflect the committed changes.

I'm going to nitpick the commit a tad...

head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c
428 ↗(On Diff #27790)

Whitespace

434–435 ↗(On Diff #27790)

Isn't this the same as n->extinq_size = MIN(length_data, NG_HCI_EXTINQ_MAX);?

439 ↗(On Diff #27790)

Whitespace

445 ↗(On Diff #27790)

Remove space after char, i.e., event = m_pullup(event, sizeof(char));

447 ↗(On Diff #27790)

Whitespace

head/sys/netgraph/bluetooth/hci/ng_hci_main.c
100 ↗(On Diff #27790)

Whitespace

head/usr.sbin/bluetooth/hccontrol/node.c
211 ↗(On Diff #27790)

Please don't redefine MIN/MAX -- it's available in sys/param.h.

213 ↗(On Diff #27790)

The definition format is incorrect:

static int
hci_dump_adv(uint8_t *data, int length)
{
219 ↗(On Diff #27790)

style(9): please add whitespace, e.g.,

while (length > 0) {

224 ↗(On Diff #27790)

Whitespace

230 ↗(On Diff #27790)

Whitespace

232 ↗(On Diff #27790)

Whitespace

238 ↗(On Diff #27790)

Whitespace

245 ↗(On Diff #27790)

Whitespace

290 ↗(On Diff #27790)
  • Whitespace
  • Please use nitems(..) instead of sizeof(x) / sizeof(x[0])
306–307 ↗(On Diff #27790)

Wrap to a single line?

308 ↗(On Diff #27790)

Why not add this to the previous fprintf?