Bluetooth: controller: Set local RPA field only when generated

Set the local RPA field of the enhanced connection complete event only
when the address was generated by the controller. If the host has
set an RPA and this one was used the controller should return all
zeroes.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-04-23 16:54:50 +02:00 committed by Carles Cufí
commit e9b39cd304
10 changed files with 40 additions and 55 deletions

View file

@ -2871,19 +2871,8 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
memcpy(&leecc->peer_addr.a.val[0], &node_rx->peer_addr[0],
BDADDR_SIZE);
/* Note: this could be an RPA set as the random address by
* the Host instead of generated by the controller. That said,
* this should make no difference.
*/
if ((node_rx->own_addr_type) &&
((node_rx->own_addr[5] & 0xc0) == 0x40)) {
memcpy(&leecc->local_rpa.val[0], &node_rx->own_addr[0],
BDADDR_SIZE);
} else {
(void)memset(&leecc->local_rpa.val[0], 0x0,
BDADDR_SIZE);
}
memcpy(&leecc->local_rpa.val[0], &node_rx->local_rpa[0],
BDADDR_SIZE);
memcpy(&leecc->peer_rpa.val[0], &node_rx->peer_rpa[0],
BDADDR_SIZE);