Skip to content

Commit 9017366

Browse files
authored
Merge pull request apache#77 from sjanc/enh_conn_complete
nimble/ll: Fix peer address in LE Enhanced Connection Complete Event
2 parents 7316d87 + abe1881 commit 9017366

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

nimble/controller/src/ble_ll_conn.c

+22
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,17 @@ ble_ll_conn_master_init(struct ble_ll_conn_sm *connsm,
17371737
if (hcc->filter_policy == 0) {
17381738
memcpy(&connsm->peer_addr, &hcc->peer_addr, BLE_DEV_ADDR_LEN);
17391739
connsm->peer_addr_type = hcc->peer_addr_type;
1740+
1741+
/* If device was added to resolve list peer type has different meaning
1742+
* and we need to adjust here. If device is on resolve list mark type as
1743+
* 'identity' as this means also RPA is allowed for connection.
1744+
*/
1745+
if ((connsm->peer_addr_type < BLE_HCI_CONN_PEER_ADDR_PUBLIC_IDENT) &&
1746+
ble_ll_resolv_list_find(connsm->peer_addr,
1747+
connsm->peer_addr_type)) {
1748+
connsm->peer_addr_type += 2;
1749+
}
1750+
17401751
}
17411752

17421753
/* XXX: for now, just make connection interval equal to max */
@@ -1840,6 +1851,17 @@ ble_ll_conn_ext_master_init(struct ble_ll_conn_sm *connsm,
18401851
if (hcc->filter_policy == 0) {
18411852
memcpy(&connsm->peer_addr, &hcc->peer_addr, BLE_DEV_ADDR_LEN);
18421853
connsm->peer_addr_type = hcc->peer_addr_type;
1854+
1855+
/* In LE Extended Create Connection peer type has different meaning
1856+
* than legacy LE Create Connection and since legacy values are used
1857+
* internally we need to adjust here. If device is on resolve list
1858+
* mark type as 'identity' as this means also RPA is allowed for
1859+
* connection.
1860+
*/
1861+
if (ble_ll_resolv_list_find(connsm->peer_addr,
1862+
connsm->peer_addr_type)) {
1863+
connsm->peer_addr_type += 2;
1864+
}
18431865
}
18441866

18451867
connsm->initial_params = *hcc;

0 commit comments

Comments
 (0)