Bluetooth: controller: Add privacy handling for LE Scan Request Recv
Scanner address returned in event should be resolved, if possible. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This commit is contained in:
parent
bca3560100
commit
3006dac9ae
3 changed files with 27 additions and 3 deletions
|
@ -3747,6 +3747,9 @@ static void le_scan_req_received(struct pdu_data *pdu_data,
|
|||
struct pdu_adv *adv = (void *)pdu_data;
|
||||
struct bt_hci_evt_le_scan_req_received *sep;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
uint8_t rl_idx;
|
||||
#endif
|
||||
|
||||
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
|
||||
!(le_event_mask & BT_EVT_MASK_LE_SCAN_REQ_RECEIVED)) {
|
||||
|
@ -3773,6 +3776,23 @@ static void le_scan_req_received(struct pdu_data *pdu_data,
|
|||
sep->addr.type = adv->tx_addr;
|
||||
memcpy(&sep->addr.a.val[0], &adv->scan_req.scan_addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
rl_idx = node_rx->hdr.rx_ftr.rl_idx;
|
||||
if (rl_idx < ll_rl_size_get()) {
|
||||
/* Store identity address */
|
||||
ll_rl_id_addr_get(rl_idx, &sep->addr.type,
|
||||
&sep->addr.a.val[0]);
|
||||
/* Mark it as identity address from RPA (0x02, 0x03) */
|
||||
sep->addr.type += 2U;
|
||||
} else {
|
||||
#else
|
||||
if (1) {
|
||||
#endif
|
||||
sep->addr.type = adv->tx_addr;
|
||||
memcpy(&sep->addr.a.val[0], &adv->adv_ind.addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_SCAN_REQ_NOTIFY */
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr,
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
|
||||
int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
|
||||
uint8_t rssi_ready)
|
||||
uint8_t rl_idx, uint8_t rssi_ready)
|
||||
{
|
||||
struct node_rx_pdu *node_rx;
|
||||
struct pdu_adv *pdu_adv;
|
||||
|
@ -153,6 +153,9 @@ int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
|
|||
|
||||
node_rx->hdr.rx_ftr.rssi = (rssi_ready) ? (radio_rssi_get() & 0x7f) :
|
||||
0x7f;
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
node_rx->hdr.rx_ftr.rl_idx = rl_idx;
|
||||
#endif
|
||||
|
||||
ull_rx_put(node_rx->hdr.link, node_rx);
|
||||
ull_rx_sched();
|
||||
|
@ -716,7 +719,8 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
|||
uint32_t err;
|
||||
|
||||
/* Generate the scan request event */
|
||||
err = lll_adv_scan_req_report(lll, pdu_rx, rssi_ready);
|
||||
err = lll_adv_scan_req_report(lll, pdu_rx, rl_idx,
|
||||
rssi_ready);
|
||||
if (err) {
|
||||
/* Scan Response will not be transmitted */
|
||||
return err;
|
||||
|
|
|
@ -77,5 +77,5 @@ bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr,
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
|
||||
int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
|
||||
uint8_t rssi_ready);
|
||||
uint8_t rl_idx, uint8_t rssi_ready);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue