Skip to content

Commit ee748cd

Browse files
committed
host/pvcy: reset state when stopping host
Without this fix, connections were not automatically resolved after stopping/starting the host/controller. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent d2ec455 commit ee748cd

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

nimble/host/src/ble_hs_pvcy.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,10 @@ ble_hs_pvcy_set_mode(const ble_addr_t *addr, uint8_t priv_mode)
261261
BLE_HCI_OCF_LE_SET_PRIVACY_MODE),
262262
&cmd, sizeof(cmd), NULL, 0);
263263
}
264+
265+
void
266+
ble_hs_pvcy_reset(void)
267+
{
268+
ble_hs_pvcy_started = 0;
269+
memset(ble_hs_pvcy_irk, 0, sizeof(ble_hs_pvcy_irk));
270+
}

nimble/host/src/ble_hs_pvcy_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ int ble_hs_pvcy_add_entry(const uint8_t *addr, uint8_t addrtype,
3535
const uint8_t *irk);
3636
int ble_hs_pvcy_ensure_started(void);
3737
int ble_hs_pvcy_set_mode(const ble_addr_t *addr, uint8_t priv_mode);
38+
void ble_hs_pvcy_reset(void);
3839

3940
#ifdef __cplusplus
4041
}

nimble/host/src/ble_hs_stop.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ ble_hs_stop_done(int status)
7474
/* After LL reset the controller loses its random address */
7575
ble_hs_id_reset();
7676

77+
ble_hs_pvcy_reset();
78+
7779
/* Clear advertising, scanning and connection states. */
7880
ble_gap_reset_state(0);
7981

0 commit comments

Comments
 (0)