-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nimble/ll: Add vs hci to set local IRK #1630
nimble/ll: Add vs hci to set local IRK #1630
Conversation
a3a4fbe
to
c3190d8
Compare
c3190d8
to
53fe496
Compare
fe5dfea
to
5007196
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea:)
if (cmdlen != sizeof(*cmd)) { | ||
return BLE_ERR_INV_HCI_CMD_PARMS; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably disallow this when initiating and advertising (?) (connectable, undirected)
#if MYNEWT_VAL(BLE_LL_HCI_VS_LOCAL_IRK) | ||
int | ||
ble_ll_resolv_local_irk_set(const uint8_t *irk) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ble_ll_resolv_irk_nonzero()
#if MYNEWT_VAL(BLE_LL_HCI_VS_LOCAL_IRK) | ||
OS_ENTER_CRITICAL(sr); | ||
if (g_local_irk.is_set) { | ||
generate_rpa(g_local_irk.irk, g_local_irk.rpa); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RPA could be generated before critical section, and critical section could be only under if (as it may be cleared only from same task)
|
||
#define BLE_HCI_OCF_VS_SET_LOCAL_IRK (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x000A)) | ||
struct ble_hci_vs_set_local_irk_cp { | ||
uint8_t irk[16]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a loose thought, maybe this could also have address type? public vs static_random
5007196
to
2cc91e0
Compare
This adds vendor-specific HCI command to set local IRK in controller. IRK can be set for both public and static random addresses separately. Local IRK, if set, is used to generate local RPA in use cases where own address type was set to 0x02 or 0x03 but peer address is not added to resolving list. This for example allows to handle initiating connection to a new peer using RPA as our local address entirely in LL. Without that command it would be required for host to generate an RPA, set it as random address and connect using random address. This however doesn't work well with NimBLE host. If no IRK is set (or set to all-zero), the controller behaves as usual which makes it safe to enable as it won't break anything.
2cc91e0
to
d706df7
Compare
This adds vendor-specific HCI command to set local IRK in controller.
Local IRK, if set, is used to generate local RPA in use cases where own address type was set to 0x02 or 0x03 but peer address is not added to resolving list. This for example allows to handle initiating connection to a new peer using RPA as our local address entirely in LL. Without that command it would be required for host to generate an RPA, set it as random address and connect using random address. This however doesn't work well with NimBLE host.
If no IRK is set (or set to all-zero), the controller behaves as usual which makes it safe to enable as it won't break anything.