Page MenuHomeFreeBSD

Bluetooth LE Security Manager Protocol Support
ClosedPublic

Authored by takawata on Oct 22 2015, 5:14 PM.

Details

Summary

This code will add BLE Security Manager Protocol(SMP) support.
This will enable userland to create SMP connection and wait connection for underlying HCI connection to be encrypted.
To create SMP connection, set sockaddr_l2cap::l2cap_cid member as NG_L2CAP_SMP_CID.
To wait until HCI connection encrypted, do following:
enc = 1;
setsockopt( s, SOL_L2CAP, SO_L2CAP_ENCRYPTED, &enc, sizeof(enc));

Some example is in http://www.init-main.com/blesmpexample.tar.gz

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

takawata updated this revision to Diff 9625.Oct 22 2015, 5:14 PM
takawata retitled this revision from to Bluetooth LE Security Manager Protocol Support.
takawata updated this object.
takawata edited the test plan for this revision. (Show Details)
takawata added a reviewer: emax.
takawata set the repository for this revision to rS FreeBSD src repository.
emax requested changes to this revision.Oct 22 2015, 5:43 PM
emax edited edge metadata.

please see comments. otherwise looks good on first read. thank you for your work!

sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
1736 ↗(On Diff #9625)

can you please remove this printf() or change it to one of the log macros?

2339 ↗(On Diff #9625)

i think this is cut and paste typo. it should read sizeof(pcb->need_encrypt), imo

2387 ↗(On Diff #9625)

do you think this should check socket state? basically, if connection is already established, i think, it should refuse to change encryption. otherwise it might give an impression that encryption can be turned on/off while connection is established.

This revision now requires changes to proceed.Oct 22 2015, 5:43 PM
takawata updated this revision to Diff 9655.Oct 23 2015, 1:28 PM
takawata edited edge metadata.
takawata retitled this revision from Bluetooth LE Security Manager Protocol Support to Bluetooth LE Security Manager Protocol Support.

Reflecting the comment.

Thank you for your comment.
I corrected the problems.
Remove printf and check pcb state before updating need_encrypt and on encryption change.

takawata updated this revision to Diff 9656.Oct 23 2015, 1:30 PM
takawata edited edge metadata.

Oops! unneeded code included.

emax accepted this revision.Oct 26 2015, 5:19 PM
emax edited edge metadata.

thank you for your work!

This revision is now accepted and ready to land.Oct 26 2015, 5:19 PM
This revision was automatically updated to reflect the committed changes.