Skip to content

Commit 4015ad2

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 c062e08 commit 4015ad2

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

nimble/host/src/ble_hs_pvcy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,9 @@ ble_hs_pvcy_set_mode(const ble_addr_t *addr, uint8_t priv_mode)
273273
BLE_HCI_OCF_LE_SET_PRIVACY_MODE),
274274
&cmd, sizeof(cmd), NULL, 0);
275275
}
276+
277+
void ble_hs_pvcy_reset(void)
278+
{
279+
ble_hs_pvcy_started = 0;
280+
memset(ble_hs_pvcy_irk, 0, sizeof(ble_hs_pvcy_irk));
281+
}

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)