From 26a46a9b3183a7b3294d77b94dc9d2dc1c0d179b Mon Sep 17 00:00:00 2001 From: Prasad Alatkar Date: Tue, 28 Apr 2020 23:40:40 +0530 Subject: [PATCH] NimBLE : Change peer_addr type to PUBLIC in case of Host based privacy - When Identity of peer is resolved and peer address is RPA then NimBLE stack changes the peer_addr type to PUBLIC_ID(0x02); in Host based privacy it should not be done as it can result in mismatch while comparing stored addresses especially in case of CCCD storage. --- nimble/host/src/ble_sm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c index d74b96bb3..53bd27da4 100644 --- a/nimble/host/src/ble_sm.c +++ b/nimble/host/src/ble_sm.c @@ -538,6 +538,11 @@ ble_sm_persist_keys(struct ble_sm_proc *proc) case BLE_ADDR_PUBLIC: case BLE_ADDR_PUBLIC_ID: conn->bhc_peer_addr.type = BLE_ADDR_PUBLIC_ID; +#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY) + /* In case of Host based privacy, we should not be changing + * peer address type to BLE_ADDR_PUBLIC_ID */ + conn->bhc_peer_addr.type = BLE_ADDR_PUBLIC; +#endif break; case BLE_ADDR_RANDOM: