Repository: incubator-mynewt-core Updated Branches: refs/heads/develop d6bbacbd9 -> 6a72c5452
when we do a key exchange and get an identity address from the peer make sure we use that address and not the device address in the key store Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/6a72c545 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6a72c545 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6a72c545 Branch: refs/heads/develop Commit: 6a72c5452f0375d5ffcc2bee5ddf59a16a149512 Parents: d6bbacb Author: Paul Dietrich <paulfdietr...@yahoo.com> Authored: Thu Jun 2 17:11:09 2016 -0700 Committer: Paul Dietrich <paulfdietr...@yahoo.com> Committed: Thu Jun 2 17:11:09 2016 -0700 ---------------------------------------------------------------------- net/nimble/host/src/ble_l2cap_sm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a72c545/net/nimble/host/src/ble_l2cap_sm.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_l2cap_sm.c b/net/nimble/host/src/ble_l2cap_sm.c index fb89877..dd944f6 100644 --- a/net/nimble/host/src/ble_l2cap_sm.c +++ b/net/nimble/host/src/ble_l2cap_sm.c @@ -517,9 +517,14 @@ ble_l2cap_sm_key_exchange_events(struct ble_l2cap_sm_proc *proc) conn = ble_hs_conn_find(proc->conn_handle); BLE_HS_DBG_ASSERT(conn != NULL); - peer_addr_type = conn->bhc_addr_type; - memcpy(peer_addr, conn->bhc_addr, sizeof peer_addr); - + /* if we got an identity address, use that for key storage */ + if(proc->peer_keys.addr_valid) { + peer_addr_type = proc->peer_keys.addr_type; + memcpy(peer_addr, proc->peer_keys.addr, sizeof peer_addr); + } else { + peer_addr_type = conn->bhc_addr_type; + memcpy(peer_addr, conn->bhc_addr, sizeof peer_addr); + } ble_hs_unlock(); authenticated = !!(proc->flags & BLE_L2CAP_SM_PROC_F_AUTHENTICATED);