From b298729501ae132532200c66fbfc458898c994d2 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 30 Jan 2025 13:35:45 +0100 Subject: [PATCH] hci: reset link key stored in connection --- src/hci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hci.c b/src/hci.c index d6a12f8f0..551c4f758 100644 --- a/src/hci.c +++ b/src/hci.c @@ -565,9 +565,15 @@ bool hci_authentication_active_for_handle(hci_con_handle_t handle){ } void gap_drop_link_key_for_bd_addr(bd_addr_t addr){ - if (!hci_stack->link_key_db) return; log_info("gap_drop_link_key_for_bd_addr: %s", bd_addr_to_str(addr)); - hci_stack->link_key_db->delete_link_key(addr); + hci_connection_t * conn = hci_connection_for_bd_addr_and_type(addr, BD_ADDR_TYPE_ACL); + if (conn) { + // reset link key stored in connection + conn->link_key_type = INVALID_LINK_KEY; + } + if (!hci_stack->link_key_db) { + hci_stack->link_key_db->delete_link_key(addr); + } } void gap_store_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_key_type_t type){