You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by pa...@apache.org on 2016/06/03 21:50:20 UTC
incubator-mynewt-core git commit: we also need to keep the peers RPA
in case we do a pairing with that address while using resolvable private
addresses
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 8c891bed0 -> b256be023
we also need to keep the peers RPA in case we do a pairing with that address while
using resolvable private addresses
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/b256be02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b256be02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b256be02
Branch: refs/heads/develop
Commit: b256be023b94dab2dfaee0ae3eeba674e6b24321
Parents: 8c891be
Author: Paul Dietrich <pa...@yahoo.com>
Authored: Fri Jun 3 14:49:54 2016 -0700
Committer: Paul Dietrich <pa...@yahoo.com>
Committed: Fri Jun 3 14:49:54 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/ble_gap.c | 1 +
net/nimble/host/src/ble_hs_conn_priv.h | 1 +
net/nimble/host/src/ble_l2cap_sm.c | 25 +++++++++++++++++++++----
3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b256be02/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 fc12d79..3834346 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -899,6 +899,7 @@ ble_gap_rx_conn_complete(struct hci_le_conn_complete *evt)
memcpy(conn->bhc_addr, evt->peer_addr, sizeof conn->bhc_addr);
conn->bhc_addr_type = evt->peer_addr_type;
memcpy(conn->our_rpa_addr, evt->local_rpa, sizeof(conn->our_rpa_addr));
+ memcpy(conn->peer_rpa_addr, evt->peer_rpa, sizeof(conn->peer_rpa_addr));
conn->bhc_itvl = evt->conn_itvl;
conn->bhc_latency = evt->conn_latency;
conn->bhc_supervision_timeout = evt->supervision_timeout;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b256be02/net/nimble/host/src/ble_hs_conn_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn_priv.h b/net/nimble/host/src/ble_hs_conn_priv.h
index 90c32e5..963b200 100644
--- a/net/nimble/host/src/ble_hs_conn_priv.h
+++ b/net/nimble/host/src/ble_hs_conn_priv.h
@@ -40,6 +40,7 @@ struct ble_hs_conn {
uint8_t our_addr_type;
uint8_t bhc_addr[6];
uint8_t our_rpa_addr[6];
+ uint8_t peer_rpa_addr[6];
uint16_t bhc_itvl;
uint16_t bhc_latency;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b256be02/net/nimble/host/src/ble_l2cap_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sm.c b/net/nimble/host/src/ble_l2cap_sm.c
index fa9e2e3..5aba968 100644
--- a/net/nimble/host/src/ble_l2cap_sm.c
+++ b/net/nimble/host/src/ble_l2cap_sm.c
@@ -973,6 +973,8 @@ ble_l2cap_sm_confirm_prepare_args(struct ble_l2cap_sm_proc *proc,
struct ble_hs_conn *conn;
uint8_t our_addr[6];
uint8_t our_addr_type;
+ uint8_t peer_addr[6];
+ uint8_t peer_addr_type;
BLE_HS_DBG_ASSERT(ble_hs_thread_safe());
@@ -1010,16 +1012,31 @@ ble_l2cap_sm_confirm_prepare_args(struct ble_l2cap_sm_proc *proc,
break;
}
+ peer_addr_type = (conn->bhc_addr_type ? 1 : 0);
+ switch(conn->bhc_addr_type) {
+ case BLE_ADDR_TYPE_PUBLIC:
+ memcpy(peer_addr, conn->bhc_addr, 6);
+ break;
+ case BLE_ADDR_TYPE_RANDOM:
+ memcpy(peer_addr, conn->bhc_addr, 6);
+ break;
+ case BLE_ADDR_TYPE_RPA_RND_DEFAULT:
+ case BLE_ADDR_TYPE_RPA_PUB_DEFAULT:
+ memcpy(peer_addr, conn->peer_rpa_addr, 6);
+ break;
+
+ }
+
if (proc->flags & BLE_L2CAP_SM_PROC_F_INITIATOR) {
memcpy(ia, our_addr, 6);
*iat = our_addr_type;
- *rat = (conn->bhc_addr_type ? 1 : 0);
- memcpy(ra, conn->bhc_addr, 6);
+ *rat = peer_addr_type;
+ memcpy(ra, peer_addr, 6);
} else {
memcpy(ra, our_addr, 6);
*rat = our_addr_type;
- *iat = (conn->bhc_addr_type ? 1 : 0);
- memcpy(ia, conn->bhc_addr, 6);
+ *iat = peer_addr_type;
+ memcpy(ia, peer_addr, 6);
}
}