You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/06/15 02:27:27 UTC

[05/50] [abbrv] incubator-mynewt-core git commit: BLE Host - include both addresses in conn desc.

BLE Host - include both addresses in conn desc.

Previous to this change, the connection descriptor returned by the GAP
only contained the peer identity address.  Now it contains both the
peer's effective address and identity address, as well as the local
effective address.


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/c5895900
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c5895900
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c5895900

Branch: refs/heads/develop
Commit: c589590065e8f04ca75f4a0503642ee61f798a17
Parents: e03ce5e
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Jun 8 08:18:23 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 19:23:34 2016 -0700

----------------------------------------------------------------------
 apps/bletiny/src/bletiny.h                  |  5 +--
 apps/bletiny/src/cmd.c                      | 21 ++++++---
 apps/bletiny/src/main.c                     | 56 ++++--------------------
 apps/bletiny/src/misc.c                     | 21 +++++++++
 net/nimble/host/include/host/ble_gap.h      |  6 ++-
 net/nimble/host/src/ble_gap.c               | 14 +++++-
 net/nimble/host/src/test/ble_gap_test.c     | 30 ++++++-------
 net/nimble/host/src/test/ble_hs_test_util.c |  2 +
 net/nimble/host/src/test/ble_os_test.c      |  4 +-
 9 files changed, 81 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/apps/bletiny/src/bletiny.h
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/bletiny.h b/apps/bletiny/src/bletiny.h
index 6ca6d77..b66a301 100644
--- a/apps/bletiny/src/bletiny.h
+++ b/apps/bletiny/src/bletiny.h
@@ -36,6 +36,7 @@ struct ble_l2cap_sig_update_params;
 union ble_store_value;
 union ble_store_key;
 struct ble_gap_adv_params;
+struct ble_gap_conn_desc;
 
 typedef int cmd_fn(int argc, char **argv);
 struct cmd_entry {
@@ -73,9 +74,6 @@ SLIST_HEAD(bletiny_svc_list, bletiny_svc);
 
 struct bletiny_conn {
     uint16_t handle;
-    uint8_t addr_type;
-    uint8_t addr[6];
-
     struct bletiny_svc_list svcs;
 };
 
@@ -206,5 +204,6 @@ void print_bytes(uint8_t *bytes, int len);
 int svc_is_empty(struct bletiny_svc *svc);
 uint16_t chr_end_handle(struct bletiny_svc *svc, struct bletiny_chr *chr);
 int chr_is_empty(struct bletiny_svc *svc, struct bletiny_chr *chr);
+void print_conn_desc(struct ble_gap_conn_desc *desc);
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index 9a3fe14..4dbdcc5 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -945,7 +945,13 @@ cmd_scan(int argc, char **argv)
 static int
 cmd_show_addr(int argc, char **argv)
 {
-    print_addr(g_dev_addr);
+    uint8_t *id_addr;
+    uint8_t id_addr_type;
+
+    id_addr = bls_hs_priv_get_local_identity_addr(&id_addr_type);
+
+    console_printf("id_addr_type=%d id_addr=", id_addr_type);
+    print_addr(id_addr);
     console_printf("\n");
 
     return 0;
@@ -961,9 +967,7 @@ cmd_show_chr(int argc, char **argv)
     for (i = 0; i < bletiny_num_conns; i++) {
         conn = bletiny_conns + i;
 
-        console_printf("CONNECTION: handle=%d addr=", conn->handle);
-        print_addr(conn->addr);
-        console_printf("\n");
+        console_printf("CONNECTION: handle=%d\n", conn->handle);
 
         SLIST_FOREACH(svc, &conn->svcs, next) {
             cmd_print_svc(svc);
@@ -976,15 +980,18 @@ cmd_show_chr(int argc, char **argv)
 static int
 cmd_show_conn(int argc, char **argv)
 {
+    struct ble_gap_conn_desc conn_desc;
     struct bletiny_conn *conn;
+    int rc;
     int i;
 
     for (i = 0; i < bletiny_num_conns; i++) {
         conn = bletiny_conns + i;
 
-        console_printf("handle=%d addr=", conn->handle);
-        print_addr(conn->addr);
-        console_printf(" addr_type=%d\n", conn->addr_type);
+        rc = ble_gap_find_conn(conn->handle, &conn_desc);
+        if (rc == 0) {
+            print_conn_desc(&conn_desc);
+        }
     }
 
     return 0;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index f2cb04e..9fdf9bf 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -160,38 +160,6 @@ bletiny_print_error(char *msg, uint16_t conn_handle,
 }
 
 static void
-bletiny_print_mac(uint8_t *mac) {
-    int i;
-    for (i = 5; i >= 0; i--) {
-        console_printf("%s0x%02x", i != 5 ? ":" : "", mac[i]);
-    }
-}
-
-static void
-bletiny_print_conn_desc(struct ble_gap_conn_desc *desc)
-{
-    console_printf("handle=%d peer_addr_type=%d peer_addr=",
-                   desc->conn_handle, desc->peer_addr_type);
-    bletiny_print_mac(desc->peer_addr);
-    console_printf(" conn_itvl=%d conn_latency=%d supervision_timeout=%d "
-                   "pair_alg=%d enc_enabled=%d authenticated=%d",
-                   desc->conn_itvl, desc->conn_latency,
-                   desc->supervision_timeout,
-                   desc->sec_state.pair_alg,
-                   desc->sec_state.enc_enabled,
-                   desc->sec_state.authenticated);
-}
-
-static void
-bletiny_print_enh_conn_info(struct ble_gap_enhanced_conn *penh)
-{
-    console_printf(" local_rpa ");
-    bletiny_print_mac(penh->local_rpa);
-    console_printf(" peer_rpa ");
-    bletiny_print_mac(penh->peer_rpa);
-}
-
-static void
 bletiny_print_adv_fields(struct ble_hs_adv_fields *fields)
 {
     uint32_t u32;
@@ -288,7 +256,7 @@ bletiny_print_adv_fields(struct ble_hs_adv_fields *fields)
 
     if (fields->le_addr != NULL) {
         console_printf("    le_addr=");
-        bletiny_print_mac(fields->le_addr);
+        print_addr(fields->le_addr);
         console_printf("\n");
     }
 
@@ -675,8 +643,6 @@ bletiny_conn_add(struct ble_gap_conn_desc *desc)
     bletiny_num_conns++;
 
     conn->handle = desc->conn_handle;
-    conn->addr_type = desc->peer_addr_type;
-    memcpy(conn->addr, desc->peer_addr, 6);
     SLIST_INIT(&conn->svcs);
 
     return conn;
@@ -925,15 +891,11 @@ bletiny_gap_event(int event, struct ble_gap_conn_ctxt *ctxt, void *arg)
 
     switch (event) {
     case BLE_GAP_EVENT_CONNECT:
+        
         console_printf("connection %s; status=%d ",
                        ctxt->connect.status == 0 ? "established" : "failed",
                        ctxt->connect.status);
-        bletiny_print_conn_desc(ctxt->desc);
-
-        if (ctxt->connect.status  == 0) {
-            bletiny_print_enh_conn_info(ctxt->connect.enhanced_conn);
-        }
-        console_printf("\n");
+        print_conn_desc(ctxt->desc);
 
         if (ctxt->connect.status == 0) {
             bletiny_conn_add(ctxt->desc);
@@ -942,7 +904,7 @@ bletiny_gap_event(int event, struct ble_gap_conn_ctxt *ctxt, void *arg)
 
     case BLE_GAP_EVENT_DISCONNECT:
         console_printf("disconnect; reason=%d ", ctxt->disconnect.reason);
-        bletiny_print_conn_desc(ctxt->desc);
+        print_conn_desc(ctxt->desc);
         console_printf("\n");
 
         conn_idx = bletiny_conn_find_idx(ctxt->desc->conn_handle);
@@ -958,7 +920,7 @@ bletiny_gap_event(int event, struct ble_gap_conn_ctxt *ctxt, void *arg)
     case BLE_GAP_EVENT_CONN_UPDATE:
         console_printf("connection updated; status=%d ",
                        ctxt->conn_update.status);
-        bletiny_print_conn_desc(ctxt->desc);
+        print_conn_desc(ctxt->desc);
         console_printf("\n");
         return 0;
 
@@ -981,7 +943,7 @@ bletiny_gap_event(int event, struct ble_gap_conn_ctxt *ctxt, void *arg)
     case BLE_GAP_EVENT_ENC_CHANGE:
         console_printf("encryption change event; status=%d ",
                        ctxt->enc_change.status);
-        bletiny_print_conn_desc(ctxt->desc);
+        print_conn_desc(ctxt->desc);
         console_printf("\n");
         return 0;
 
@@ -1013,7 +975,7 @@ bletiny_on_scan(int event, int status, struct ble_gap_disc_desc *desc,
     case BLE_GAP_EVENT_DISC_SUCCESS:
         console_printf("received advertisement; event_type=%d addr_type=%d "
                        "addr=", desc->event_type, desc->addr_type);
-        bletiny_print_mac(desc->addr);
+        print_addr(desc->addr);
         console_printf(" length_data=%d rssi=%d data=", desc->length_data,
                        desc->rssi);
         print_bytes(desc->data, desc->length_data);
@@ -1429,8 +1391,8 @@ bletiny_sec_restart(uint16_t conn_handle,
         }
 
         memset(&key_sec, 0, sizeof key_sec);
-        key_sec.peer_addr_type = desc.peer_addr_type;
-        memcpy(key_sec.peer_addr, desc.peer_addr, 6);
+        key_sec.peer_addr_type = desc.peer_id_addr_type;
+        memcpy(key_sec.peer_addr, desc.peer_id_addr, 6);
 
         rc = ble_hs_atomic_conn_flags(conn_handle, &conn_flags);
         if (rc != 0) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/apps/bletiny/src/misc.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/misc.c b/apps/bletiny/src/misc.c
index 179c9a7..a96a388 100644
--- a/apps/bletiny/src/misc.c
+++ b/apps/bletiny/src/misc.c
@@ -19,6 +19,7 @@
 
 #include "console/console.h"
 #include "host/ble_uuid.h"
+#include "host/ble_gap.h"
 
 #include "bletiny.h"
 
@@ -91,3 +92,23 @@ chr_is_empty(struct bletiny_svc *svc, struct bletiny_chr *chr)
 {
     return chr_end_handle(svc, chr) <= chr->chr.val_handle;
 }
+
+void
+print_conn_desc(struct ble_gap_conn_desc *desc)
+{
+    console_printf("handle=%d peer_effective_addr_type=%d "
+                   "peer_effective_addr=",
+                   desc->conn_handle, desc->peer_effective_addr_type);
+    print_addr(desc->peer_effective_addr);
+    console_printf(" peer_identity_addr_type=%d peer_identity_addr=",
+                   desc->peer_id_addr_type);
+    print_addr(desc->peer_id_addr);
+    console_printf(" conn_itvl=%d conn_latency=%d supervision_timeout=%d "
+                   "pair_alg=%d enc_enabled=%d authenticated=%d bonded=%d\n",
+                   desc->conn_itvl, desc->conn_latency,
+                   desc->supervision_timeout,
+                   desc->sec_state.pair_alg,
+                   desc->sec_state.enc_enabled,
+                   desc->sec_state.authenticated,
+                   desc->sec_state.bonded);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/net/nimble/host/include/host/ble_gap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h
index c68a957..03f4dcd 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -119,12 +119,14 @@ struct ble_gap_adv_params {
 
 struct ble_gap_conn_desc {
     struct ble_gap_sec_state sec_state;
-    uint8_t peer_addr[6];
+    uint8_t peer_effective_addr[6];
+    uint8_t peer_id_addr[6];
     uint16_t conn_handle;
     uint16_t conn_itvl;
     uint16_t conn_latency;
     uint16_t supervision_timeout;
-    uint8_t peer_addr_type;
+    uint8_t peer_effective_addr_type;
+    uint8_t peer_id_addr_type;
 };
 
 struct ble_gap_crt_params {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index a54042f..dec124a 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -273,9 +273,19 @@ static void
 ble_gap_fill_conn_desc(struct ble_hs_conn *conn,
                        struct ble_gap_conn_desc *desc)
 {
+    uint8_t *peer_effective_addr;
+    uint8_t *peer_id_addr;
+    uint8_t *our_effective_addr;
+
+    ble_hs_conn_addrs(conn,
+                      NULL, &our_effective_addr,
+                      NULL, NULL,
+                      &desc->peer_effective_addr_type, &peer_effective_addr,
+                      &desc->peer_id_addr_type, &peer_id_addr);
+
     desc->conn_handle = conn->bhc_handle;
-    desc->peer_addr_type = conn->bhc_addr_type;
-    memcpy(desc->peer_addr, conn->bhc_addr, sizeof desc->peer_addr);
+    memcpy(desc->peer_effective_addr, peer_effective_addr, 6);
+    memcpy(desc->peer_id_addr, peer_id_addr, 6);
     desc->conn_itvl = conn->bhc_itvl;
     desc->conn_latency = conn->bhc_latency;
     desc->supervision_timeout = conn->bhc_supervision_timeout;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/net/nimble/host/src/test/ble_gap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gap_test.c b/net/nimble/host/src/test/ble_gap_test.c
index 620c067..7868f2a 100644
--- a/net/nimble/host/src/test/ble_gap_test.c
+++ b/net/nimble/host/src/test/ble_gap_test.c
@@ -706,7 +706,7 @@ TEST_CASE(ble_gap_test_case_conn_dir_good)
 
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONNECT);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
 
     TEST_ASSERT(ble_hs_atomic_conn_flags(2, NULL) == 0);
 }
@@ -838,7 +838,7 @@ TEST_CASE(ble_gap_test_case_conn_cancel_ctlr_fail)
 
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONNECT);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr,
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr,
                        peer_addr, 6) == 0);
 
     TEST_ASSERT(ble_hs_atomic_conn_flags(2, NULL) == 0);
@@ -909,8 +909,8 @@ TEST_CASE(ble_gap_test_case_conn_terminate_good)
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_DISCONNECT);
     TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_ENOTCONN);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(ble_gap_test_conn_desc.peer_addr_type == BLE_ADDR_TYPE_PUBLIC);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(ble_gap_test_conn_desc.peer_id_addr_type == BLE_ADDR_TYPE_PUBLIC);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_arg == NULL);
 
     TEST_ASSERT(ble_hs_atomic_conn_flags(2, NULL) == BLE_HS_ENOTCONN);
@@ -948,8 +948,8 @@ TEST_CASE(ble_gap_test_case_conn_terminate_ctlr_fail)
     TEST_ASSERT(ble_gap_test_conn_status ==
                 BLE_HS_HCI_ERR(BLE_ERR_UNSUPPORTED));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(ble_gap_test_conn_desc.peer_addr_type == BLE_ADDR_TYPE_PUBLIC);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(ble_gap_test_conn_desc.peer_id_addr_type == BLE_ADDR_TYPE_PUBLIC);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_arg == NULL);
 
     TEST_ASSERT(ble_hs_atomic_conn_flags(2, NULL) == 0);
@@ -1128,7 +1128,7 @@ TEST_CASE(ble_gap_test_case_conn_adv_good)
                             BLE_GAP_EVENT_CONNECT);
                 TEST_ASSERT(ble_gap_test_conn_status == 0);
                 TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-                TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr,
+                TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr,
                                    peer_addr, 6) == 0);
                 TEST_ASSERT(ble_gap_test_conn_arg == NULL);
             }
@@ -1318,7 +1318,7 @@ ble_gap_test_util_update(struct ble_gap_upd_params *params,
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl == params->itvl_max);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency == params->latency);
     TEST_ASSERT(ble_gap_test_conn_desc.supervision_timeout ==
@@ -1332,7 +1332,7 @@ fail:
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == status);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl ==
                 BLE_GAP_INITIAL_CONN_ITVL_MAX);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency ==
@@ -1363,7 +1363,7 @@ ble_gap_test_util_update_peer(uint8_t status,
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_HCI_ERR(status));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr,
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr,
                        peer_addr, 6) == 0);
 
     if (status == 0) {
@@ -1418,7 +1418,7 @@ ble_gap_test_util_update_req_pos(struct ble_gap_upd_params *peer_params,
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl == self_params->itvl_max);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency == self_params->latency);
     TEST_ASSERT(ble_gap_test_conn_desc.supervision_timeout ==
@@ -1430,7 +1430,7 @@ hci_fail:
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_HCI_ERR(hci_status));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl ==
                 BLE_GAP_INITIAL_CONN_ITVL_MAX);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency ==
@@ -1479,7 +1479,7 @@ hci_fail:
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_HCI_ERR(hci_status));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl ==
                 BLE_GAP_INITIAL_CONN_ITVL_MAX);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency ==
@@ -1554,7 +1554,7 @@ ble_gap_test_util_update_req_concurrent(
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl == self_params->itvl_max);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency == self_params->latency);
     TEST_ASSERT(ble_gap_test_conn_desc.supervision_timeout ==
@@ -1566,7 +1566,7 @@ hci_fail:
     TEST_ASSERT(ble_gap_test_conn_event == BLE_GAP_EVENT_CONN_UPDATE);
     TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_HCI_ERR(fail_status));
     TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_addr, peer_addr, 6) == 0);
+    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr, peer_addr, 6) == 0);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_itvl ==
                 BLE_GAP_INITIAL_CONN_ITVL_MAX);
     TEST_ASSERT(ble_gap_test_conn_desc.conn_latency ==

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index bb7ea89..5a8cac1 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -819,4 +819,6 @@ ble_hs_test_util_init(void)
     ble_hs_cfg.max_outstanding_pkts_per_conn = 0;
 
     ble_hs_test_util_prev_hci_tx_clear();
+
+    ble_hs_test_util_set_public_addr(g_dev_addr);
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c5895900/net/nimble/host/src/test/ble_os_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_os_test.c b/net/nimble/host/src/test/ble_os_test.c
index 587bd11..ee7ffd6 100644
--- a/net/nimble/host/src/test/ble_os_test.c
+++ b/net/nimble/host/src/test/ble_os_test.c
@@ -108,8 +108,8 @@ ble_gap_direct_connect_test_connect_cb(int event,
     TEST_ASSERT(event == BLE_GAP_EVENT_CONNECT);
     TEST_ASSERT(ctxt->connect.status == 0);
     TEST_ASSERT(ctxt->desc->conn_handle == 2);
-    TEST_ASSERT(ctxt->desc->peer_addr_type == BLE_ADDR_TYPE_PUBLIC);
-    TEST_ASSERT(memcmp(ctxt->desc->peer_addr, ble_os_test_peer_addr, 6) == 0);
+    TEST_ASSERT(ctxt->desc->peer_id_addr_type == BLE_ADDR_TYPE_PUBLIC);
+    TEST_ASSERT(memcmp(ctxt->desc->peer_id_addr, ble_os_test_peer_addr, 6) == 0);
 
     return 0;
 }