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

[mynewt-nimble] branch master updated: nimble/ll: Fix enh connection complete event as a master

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new de4a79f  nimble/ll: Fix enh connection complete event as a master
de4a79f is described below

commit de4a79f3452fb5ff09bdca698b2894b9a49e4663
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Tue Feb 5 17:04:21 2019 +0100

    nimble/ll: Fix enh connection complete event as a master
    
    This patch fixes incorretly used identity address as a local rpa address
    in the LE Enhanced Connection Complete Evt
---
 nimble/controller/include/controller/ble_ll_conn.h | 3 +--
 nimble/controller/src/ble_ll_conn.c                | 2 ++
 nimble/controller/src/ble_ll_conn_hci.c            | 7 ++++---
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll_conn.h b/nimble/controller/include/controller/ble_ll_conn.h
index 8652a11..bc80f23 100644
--- a/nimble/controller/include/controller/ble_ll_conn.h
+++ b/nimble/controller/include/controller/ble_ll_conn.h
@@ -271,8 +271,7 @@ struct ble_ll_conn_sm
     uint32_t last_rxd_pdu_cputime;  /* Used exclusively for supervision timer */
 
     /*
-     * Used to mark that direct advertising from the peer was using
-     * identity address as InitA
+     * Used to mark that identity address was used as InitA
      */
     uint8_t inita_identity_used;
 
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index 8b40e67..296da90 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -2772,6 +2772,8 @@ ble_ll_conn_req_pdu_update(struct os_mbuf *m, uint8_t *adva, uint8_t addr_type,
 
         if (addr) {
             memcpy(dptr, addr, BLE_DEV_ADDR_LEN);
+            /* Identity address used */
+            connsm->inita_identity_used = 1;
         }
     }
 
diff --git a/nimble/controller/src/ble_ll_conn_hci.c b/nimble/controller/src/ble_ll_conn_hci.c
index 3e6f03a..1a8d3a0 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -164,9 +164,10 @@ ble_ll_conn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t status,
                 memset(evdata, 0, 2 * BLE_DEV_ADDR_LEN);
                 if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) {
                     if (connsm->inita_identity_used) {
-                        /* If it was direct advertising we were replying to and we used
-                         * identity address there (which might be just fine), we should
-                         * we should take it into account here in this event.
+                        /* We used identity address in CONNECT_IND which can be just fine if
+                         * a) it was direct advertising we replied to and remote uses its identity address
+                         * in device privacy mode or IRK is all zeros.
+                         * b) peer uses RPA and this is first time we connect to him
                          */
                         rpa = NULL;
                     } else  if (connsm->own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {