This is an automated email from the ASF dual-hosted git repository. naraj pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit d442270f5e3e8e7b736215bef83740bb41173371 Author: MichaĆ Narajowski <michal.narajow...@codecoup.pl> AuthorDate: Wed Jan 9 16:51:07 2019 +0100 host: Fix setting conn's peer RPA address in SM Change introduced in previous commit already stores a peer RPA address in proper field inside connection structure, so we can update the condition to use peer_rpa_addr field to check if address was resolved. --- nimble/host/src/ble_sm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c index 09b33bf..127c1ae 100644 --- a/nimble/host/src/ble_sm.c +++ b/nimble/host/src/ble_sm.c @@ -524,15 +524,14 @@ ble_sm_persist_keys(struct ble_sm_proc *proc) memcpy(peer_addr.val, proc->peer_keys.addr, sizeof peer_addr.val); conn->bhc_peer_addr = peer_addr; + /* Update identity address in conn. - * If peer's address was an RPA, we store it as RPA since peer's address - * will not be an identity address. The peer's address type has to be + * If peer's rpa address is set then it means that the peer's address + * is an identity address. The peer's address type has to be * set as 'ID' to allow resolve 'id' and 'ota' addresses properly in * conn info. */ - if (BLE_ADDR_IS_RPA(&conn->bhc_peer_addr)) { - conn->bhc_peer_rpa_addr = conn->bhc_peer_addr; - + if (memcmp(BLE_ADDR_ANY->val, &conn->bhc_peer_rpa_addr.val, 6) != 0) { switch (peer_addr.type) { case BLE_ADDR_PUBLIC: case BLE_ADDR_PUBLIC_ID: