You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by "sjanc (via GitHub)" <gi...@apache.org> on 2023/10/05 11:05:43 UTC
Re: [PR] nimble/ll: Add vs hci to set local IRK [mynewt-nimble]
sjanc commented on code in PR #1630:
URL: https://github.com/apache/mynewt-nimble/pull/1630#discussion_r1347233765
##########
nimble/controller/src/ble_ll_resolv.c:
##########
@@ -637,6 +660,43 @@ ble_ll_resolv_gen_rpa(uint8_t *addr, uint8_t addr_type, uint8_t *rpa, int local)
return 0;
}
+#if MYNEWT_VAL(BLE_LL_HCI_VS_LOCAL_IRK)
+int
+ble_ll_resolv_local_irk_set(const uint8_t *irk)
+{
Review Comment:
use ble_ll_resolv_irk_nonzero()
##########
nimble/controller/src/ble_ll_hci_vs.c:
##########
@@ -328,6 +329,29 @@ ble_ll_hci_vs_set_antenna(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
}
#endif
+#if MYNEWT_VAL(BLE_LL_HCI_VS_LOCAL_IRK)
+static int
+ble_ll_hci_vs_set_local_irk(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
+ uint8_t *rspbuf, uint8_t *rsplen)
+{
+ const struct ble_hci_vs_set_local_irk_cp *cmd = (const void *)cmdbuf;
+ int rc;
+
+ if (cmdlen != sizeof(*cmd)) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
Review Comment:
we should probably disallow this when initiating and advertising (?) (connectable, undirected)
##########
nimble/controller/src/ble_ll_resolv.c:
##########
@@ -141,6 +156,14 @@ ble_ll_resolv_rpa_timer_cb(struct ble_npl_event *ev)
++rl;
}
+#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);
Review Comment:
RPA could be generated before critical section, and critical section could be only under if (as it may be cleared only from same task)
##########
nimble/include/nimble/hci_common.h:
##########
@@ -1208,8 +1208,10 @@ struct ble_hci_vs_set_data_len_rp {
struct ble_hci_vs_set_antenna_cp {
uint8_t antenna;
} __attribute__((packed));
-
-
+#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];
Review Comment:
just a loose thought, maybe this could also have address type? public vs static_random
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org