The patch is used to load the entries in the local IRK to the Bluetooth LE controller resolving list. Signed-off-by: Sathish Narsimman <sathish.narasimman@xxxxxxxxx> Signed-off-by: Joy Shermin <shermin.joy@xxxxxxxxx> --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_request.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 43d31a9339a6..46d2d3e10c97 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1659,6 +1659,7 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *bdaddr_type); int hci_req_update_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr, u8 irk[16]); +void hci_load_resolving_list(struct hci_dev *hdev); void hci_req_update_resolving_list_local_irk(struct hci_dev *hdev); void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 9ffb62178d24..e17db3103a3d 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1015,6 +1015,35 @@ void hci_req_update_resolving_list_local_irk(struct hci_dev *hdev) hci_req_run(&req, NULL); } +void hci_load_resolving_list (struct hci_dev *hdev) +{ + struct smp_irk *irk; + u8 num = 0; + + /* Nothing to be done if LL privacy is not supported */ + if ( !(hdev->le_features[0] & HCI_LE_LL_PRIVACY) ) + return; + + if ( !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && + ( hci_dev_test_flag(hdev, HCI_LE_ADV) || + hci_dev_test_flag(hdev, HCI_LE_SCAN) || + hci_lookup_le_connect(hdev) ) ) + return; + + /* Load the first le_resolving_list_size entries from IRK + * list in to resolving list. + */ + rcu_read_lock(); + list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { + if (num++ >= hdev->le_resolv_list_size) + return; + + hci_req_update_resolving_list(hdev, irk->addr_type, &irk->bdaddr, irk->val); + } + + rcu_read_unlock(); +} + void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr) { struct hci_cp_le_del_from_resolv_list cp; -- 2.17.1