nimble/ll: Fix reporting peer ID addr without WL enabled

If WL is disabled and host provided peer RPA in LE Create Connection
peer address and adress type needs to be updated. Otheerwise host
will receive LE Enhanced Connection event with invalid ID address
and ID address type.

This was affecting LL/CON/MAS/BV-102-C qualification test case.
This commit is contained in:
Szymon Janc
2019-11-14 09:20:09 +01:00
parent ae50afac60
commit 81ab69c74d
+18 -20
View File
@@ -2715,9 +2715,6 @@ void
ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf,
struct ble_mbuf_hdr *ble_hdr)
{
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
int8_t rpa_index;
#endif
uint8_t addr_type;
uint8_t *addr;
uint8_t *adv_addr;
@@ -2791,30 +2788,25 @@ ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf,
goto scan_continue;
}
if (ble_ll_scan_whitelist_enabled()) {
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
/*
* Did we resolve this address? If so, set correct peer address
* and peer address type.
*/
rpa_index = connsm->rpa_index;
if (rpa_index >= 0) {
addr_type = g_ble_ll_resolv_list[rpa_index].rl_addr_type + 2;
addr = g_ble_ll_resolv_list[rpa_index].rl_identity_addr;
} else {
addr = adv_addr;
}
#else
/*
* Did we resolve this address? If so, set correct peer address
* and peer address type.
*/
if (connsm->rpa_index >= 0) {
addr_type = g_ble_ll_resolv_list[connsm->rpa_index].rl_addr_type + 2;
addr = g_ble_ll_resolv_list[connsm->rpa_index].rl_identity_addr;
} else {
addr = adv_addr;
}
#else
addr = adv_addr;
#endif
if (connsm->rpa_index >= 0) {
connsm->peer_addr_type = addr_type;
memcpy(connsm->peer_addr, addr, BLE_DEV_ADDR_LEN);
}
if (connsm->rpa_index >= 0) {
ble_ll_scan_set_peer_rpa(adv_addr);
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
@@ -2825,6 +2817,12 @@ ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf,
}
#endif
} else if (ble_ll_scan_whitelist_enabled()) {
/* if WL is used we need to store peer addr also if it was not
* resolved
*/
connsm->peer_addr_type = addr_type;
memcpy(connsm->peer_addr, addr, BLE_DEV_ADDR_LEN);
}
/* Connection has been created. Stop scanning */