From ccb640bc21a794bcf7b6cf6b4d21691822be9cdd Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Wed, 18 Sep 2024 00:36:37 +0200 Subject: [PATCH] nimble/host: Preempt GAP operations before removing entry from RL --- nimble/host/src/ble_hs_pvcy.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/nimble/host/src/ble_hs_pvcy.c b/nimble/host/src/ble_hs_pvcy.c index dc09b51ba8..f7cf090c09 100644 --- a/nimble/host/src/ble_hs_pvcy.c +++ b/nimble/host/src/ble_hs_pvcy.c @@ -59,8 +59,8 @@ ble_hs_pvcy_set_resolve_enabled(int enable) &cmd, sizeof(cmd), NULL, 0); } -int -ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr) +static int +ble_hs_pvcy_remove_entry_hci(uint8_t addr_type, const uint8_t *addr) { struct ble_hci_le_rmv_resolve_list_cp cmd; @@ -76,6 +76,21 @@ ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr) &cmd, sizeof(cmd), NULL, 0); } +int +ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr) +{ + int rc; + + /* Need to preempt all GAP procedures (advertising, pending connections) + * before modifying resolving list in the controller + */ + ble_gap_preempt(); + rc = ble_hs_pvcy_remove_entry_hci(addr_type, addr); + ble_gap_preempt_done(); + + return rc; +} + static int ble_hs_pvcy_clear_entries(void) {