You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2019/01/11 16:07:37 UTC

[mynewt-nimble] 07/07: host: Fix conn find by RPA address

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 44f1a188d98fbbd15ea2709dd287b1604ee7fca2
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jan 9 16:40:12 2019 +0100

    host: Fix conn find by RPA address
    
    When argument address is RPA then compare with peer rpa address field.
---
 nimble/host/src/ble_hs_conn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/nimble/host/src/ble_hs_conn.c b/nimble/host/src/ble_hs_conn.c
index 00fa4f8..2e23da3 100644
--- a/nimble/host/src/ble_hs_conn.c
+++ b/nimble/host/src/ble_hs_conn.c
@@ -300,8 +300,14 @@ ble_hs_conn_find_by_addr(const ble_addr_t *addr)
     }
 
     SLIST_FOREACH(conn, &ble_hs_conns, bhc_next) {
-        if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) {
-            return conn;
+        if (BLE_ADDR_IS_RPA(addr)) {
+            if (ble_addr_cmp(&conn->bhc_peer_rpa_addr, addr) == 0) {
+                return conn;
+            }
+        } else {
+            if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) {
+                return conn;
+            }
         }
     }