Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Sathish Narsimman <nsathish41@gmail.com>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	chethan.tumkur.narayan@intel.com,
	Sathish Narsimman <sathish.narasimman@intel.com>,
	Joy Shermin <shermin.joy@intel.com>
Subject: Re: [PATCH 4/7] Bluetooth: LL_PRIVACY re-load resolving list
Date: Wed, 18 Mar 2020 12:06:48 +0100	[thread overview]
Message-ID: <7F7F5693-AF9F-423C-9439-FD394CC4A8B1@holtmann.org> (raw)
In-Reply-To: <20200312100754.3445-5-sathish.narasimman@intel.com>

Hi Sathish,

> 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@intel.com>
> Signed-off-by: Joy Shermin <shermin.joy@intel.com>
> ---
> 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);
> +	}

I comparison to the le_whitelist, the le_resolv_list_size does not have to match the actual available memory of the controller. It is just some guesstimate. I think we have to design this in a way that we add the IRK anyway and handle the error case gracefully.

I am also confused why we are not actually checking here if an entry is already present and just loading the whole list. I have seen code being duplicated in at least 3 places now.

Regards

Marcel


  reply	other threads:[~2020-03-18 11:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 10:07 [PATCH 0/7] LE LL Priavcy support enabled Sathish Narsimman
2020-03-12 10:07 ` [PATCH 1/7] Bluetooth: LL Privacy Delete Store Resolving list Sathish Narsimman
2020-03-18 10:42   ` Marcel Holtmann
2020-03-18 10:47     ` Sathish Narasimman
2020-03-12 10:07 ` [PATCH 2/7] Bluetooth: Add device to Resolving List Sathish Narsimman
2020-03-18  9:29   ` Szymon Janc
2020-03-18 10:29     ` Sathish Narasimman
2020-03-12 10:07 ` [PATCH 3/7] Bluetooth: Update the Resolving list when Local IRK changed Sathish Narsimman
2020-03-18 10:45   ` Marcel Holtmann
2020-03-12 10:07 ` [PATCH 4/7] Bluetooth: LL_PRIVACY re-load resolving list Sathish Narsimman
2020-03-18 11:06   ` Marcel Holtmann [this message]
2020-03-12 10:07 ` [PATCH 5/7] Bluetooth: LL Privacy Check and Update the Resolving List Sathish Narsimman
2020-03-12 10:07 ` [PATCH 6/7] Bluetooth: Enable LL Privacy Sathish Narsimman
2020-03-18 11:04   ` Marcel Holtmann
2020-03-12 10:07 ` [PATCH 7/7] Bluetooth LL Privacy update White list Sathish Narsimman
2020-03-18  8:56 ` [PATCH 0/7] LE LL Priavcy support enabled Sathish Narasimman
2020-04-01 20:04   ` Abhishek Pandit-Subedi
2020-04-06 16:34     ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7F7F5693-AF9F-423C-9439-FD394CC4A8B1@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=nsathish41@gmail.com \
    --cc=sathish.narasimman@intel.com \
    --cc=shermin.joy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox