Skip to content

Commit 0eee35b

Browse files
committed
Bluetooth: Update resolving list when updating whitelist
When the whitelist is updated, then also update the entries of the resolving list for devices where IRKs are available. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Sathish Narsimman <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent e1d5723 commit 0eee35b

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

net/bluetooth/hci_request.c

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,21 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
694694
bt_dev_dbg(req->hdev, "Remove %pMR (0x%x) from whitelist", &cp.bdaddr,
695695
cp.bdaddr_type);
696696
hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
697+
698+
if (use_ll_privacy(req->hdev)) {
699+
struct smp_irk *irk;
700+
701+
irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
702+
if (irk) {
703+
struct hci_cp_le_del_from_resolv_list cp;
704+
705+
cp.bdaddr_type = bdaddr_type;
706+
bacpy(&cp.bdaddr, bdaddr);
707+
708+
hci_req_add(req, HCI_OP_LE_DEL_FROM_RESOLV_LIST,
709+
sizeof(cp), &cp);
710+
}
711+
}
697712
}
698713

699714
/* Adds connection to white list if needed. On error, returns -1. */
@@ -714,7 +729,7 @@ static int add_to_white_list(struct hci_request *req,
714729
return -1;
715730

716731
/* White list can not be used with RPAs */
717-
if (!allow_rpa &&
732+
if (!allow_rpa && !use_ll_privacy(hdev) &&
718733
hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
719734
return -1;
720735
}
@@ -732,6 +747,28 @@ static int add_to_white_list(struct hci_request *req,
732747
cp.bdaddr_type);
733748
hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
734749

750+
if (use_ll_privacy(hdev)) {
751+
struct smp_irk *irk;
752+
753+
irk = hci_find_irk_by_addr(hdev, &params->addr,
754+
params->addr_type);
755+
if (irk) {
756+
struct hci_cp_le_add_to_resolv_list cp;
757+
758+
cp.bdaddr_type = params->addr_type;
759+
bacpy(&cp.bdaddr, &params->addr);
760+
memcpy(cp.peer_irk, irk->val, 16);
761+
762+
if (hci_dev_test_flag(hdev, HCI_PRIVACY))
763+
memcpy(cp.local_irk, hdev->irk, 16);
764+
else
765+
memset(cp.local_irk, 0, 16);
766+
767+
hci_req_add(req, HCI_OP_LE_ADD_TO_RESOLV_LIST,
768+
sizeof(cp), &cp);
769+
}
770+
}
771+
735772
return 0;
736773
}
737774

@@ -772,7 +809,7 @@ static u8 update_white_list(struct hci_request *req)
772809
}
773810

774811
/* White list can not be used with RPAs */
775-
if (!allow_rpa &&
812+
if (!allow_rpa && !use_ll_privacy(hdev) &&
776813
hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
777814
return 0x00;
778815
}

0 commit comments

Comments
 (0)