You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/08/05 12:07:48 UTC

[mynewt-nimble] branch master updated: nimble/ll: Fix privacy handling when connecting to a new device

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

andk 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 8447ec29 nimble/ll: Fix privacy handling when connecting to a new device
8447ec29 is described below

commit 8447ec2969de52dfd2dcde6b85277265f7b5dc8d
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jul 19 14:07:40 2022 +0200

    nimble/ll: Fix privacy handling when connecting to a new device
    
    Using LL Privacy to initiate a connection to a new device (i.e. use 0x02
    or 0x03 as own address type, peer is using an RPA) requires host to add
    peer RPA and our IRK to resolving list. In this case we should allow to
    match that RPA as an identity address on resolving list so we can use
    proper privacy settings.
    
    Note that this is a bit of an unspecified behavior, i.e. HCI LE Add
    Device To Resolving List command parameters indicates that only identity
    addresses shall be added to resolving list, but this does not seem to be
    specified anywhere and there is no handling for non-identity address
    specified. So basically we allow RPA-as-an-identity to be added to
    resolving list, then if AdvA RPA does not match resolving list we just
    fall through to see if corresponding entry in resolving list exists and
    use it as identity address.
---
 nimble/controller/src/ble_ll_scan.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 6359cf7c..4893b2b0 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -1275,17 +1275,17 @@ ble_ll_scan_rx_filter(uint8_t own_addr_type, uint8_t scan_filt_policy,
 
     switch (ble_ll_addr_subtype(addrd->adva, addrd->adva_type)) {
     case BLE_LL_ADDR_SUBTYPE_RPA:
-        if (addrd->rpa_index < 0) {
+        if (addrd->rpa_index >= 0) {
+            addrd->adva_resolved = 1;
+
+            /* Use resolved identity address as advertiser address */
+            rl = &g_ble_ll_resolv_list[addrd->rpa_index];
+            addrd->adv_addr = rl->rl_identity_addr;
+            addrd->adv_addr_type = rl->rl_addr_type;
             break;
         }
 
-        addrd->adva_resolved = 1;
-
-        /* Use resolved identity address as advertiser address */
-        rl = &g_ble_ll_resolv_list[addrd->rpa_index];
-        addrd->adv_addr = rl->rl_identity_addr;
-        addrd->adv_addr_type = rl->rl_addr_type;
-        break;
+        /* fall-through */
     case BLE_LL_ADDR_SUBTYPE_IDENTITY:
         /* If AdvA is an identity address, we need to check if that device was
          * added to RL in order to use proper privacy mode.