This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 4659d1998 host/pvcy: reset state when stopping host
4659d1998 is described below

commit 4659d199835ca680631fa3d54494377c8796e780
Author: Gerard Marull-Paretas <[email protected]>
AuthorDate: Mon Jun 30 17:56:37 2025 +0200

    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 <[email protected]>
---
 nimble/host/src/ble_hs_pvcy.c      | 7 +++++++
 nimble/host/src/ble_hs_pvcy_priv.h | 1 +
 nimble/host/src/ble_hs_stop.c      | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/nimble/host/src/ble_hs_pvcy.c b/nimble/host/src/ble_hs_pvcy.c
index f7cf090c0..c12263356 100644
--- a/nimble/host/src/ble_hs_pvcy.c
+++ b/nimble/host/src/ble_hs_pvcy.c
@@ -261,3 +261,10 @@ ble_hs_pvcy_set_mode(const ble_addr_t *addr, uint8_t 
priv_mode)
                                         BLE_HCI_OCF_LE_SET_PRIVACY_MODE),
                              &cmd, sizeof(cmd), NULL, 0);
 }
+
+void
+ble_hs_pvcy_reset(void)
+{
+    ble_hs_pvcy_started = 0;
+    memset(ble_hs_pvcy_irk, 0, sizeof(ble_hs_pvcy_irk));
+}
diff --git a/nimble/host/src/ble_hs_pvcy_priv.h 
b/nimble/host/src/ble_hs_pvcy_priv.h
index 7f0aa4b90..59a132cd4 100644
--- a/nimble/host/src/ble_hs_pvcy_priv.h
+++ b/nimble/host/src/ble_hs_pvcy_priv.h
@@ -35,6 +35,7 @@ int ble_hs_pvcy_add_entry(const uint8_t *addr, uint8_t 
addrtype,
                           const uint8_t *irk);
 int ble_hs_pvcy_ensure_started(void);
 int ble_hs_pvcy_set_mode(const ble_addr_t *addr, uint8_t priv_mode);
+void ble_hs_pvcy_reset(void);
 
 #ifdef __cplusplus
 }
diff --git a/nimble/host/src/ble_hs_stop.c b/nimble/host/src/ble_hs_stop.c
index 2a07329eb..6d5c36d8f 100644
--- a/nimble/host/src/ble_hs_stop.c
+++ b/nimble/host/src/ble_hs_stop.c
@@ -74,6 +74,8 @@ ble_hs_stop_done(int status)
     /* After LL reset the controller loses its random address */
     ble_hs_id_reset();
 
+    ble_hs_pvcy_reset();
+
     /* Clear advertising, scanning and connection states. */
     ble_gap_reset_state(0);
 

Reply via email to