Skip to content

Commit e9bda73

Browse files
committed
Workaround for reinitialized stack bonding failue.
1 parent 5fe1180 commit e9bda73

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/nimble/host/src/ble_hs_resolv.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,25 @@ ble_hs_resolv_list_add(uint8_t *cmdbuf)
567567
addr_type = cmdbuf[0];
568568
ident_addr = cmdbuf + 1;
569569

570+
/*--------------------------------------------------------------------------------*/
571+
/* Temporary workaround to resolve an issue when deinitializing the stack
572+
* and reinitializing. If the a peer deletes the bonding info after deiniting
573+
* it will not be able to re-bond without this. Awaiting upstream fix.
574+
*/
575+
/*
570576
if (ble_hs_is_on_resolv_list(ident_addr, addr_type)) {
571577
return BLE_HS_EINVAL;
572578
}
579+
*/
580+
int position = ble_hs_is_on_resolv_list(ident_addr, addr_type);
581+
if (position) {
582+
memmove(&g_ble_hs_resolv_list[position],
583+
&g_ble_hs_resolv_list[position + 1],
584+
(g_ble_hs_resolv_data.rl_cnt - position) * sizeof (struct
585+
ble_hs_resolv_entry));
586+
--g_ble_hs_resolv_data.rl_cnt;
587+
}
588+
/*--------------------------------------------------------------------------------*/
573589

574590
rl = &g_ble_hs_resolv_list[g_ble_hs_resolv_data.rl_cnt];
575591
memset(rl, 0, sizeof(*rl));

0 commit comments

Comments
 (0)