linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shermin Joy <shermin.joy@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFC v2 3/3] Use whitelist along with resolving list to enable device filtering
Date: Mon, 9 Oct 2017 15:22:52 +0530	[thread overview]
Message-ID: <59db4697.d505630a.16da5.e54a@mx.google.com> (raw)

A peer device using an RPA can be added to the whitelist, if it is
present in the resolving list.

Signed-off-by: Shermin Joy <shermin.joy@gmail.com>
---
 net/bluetooth/hci_request.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 347054d..5be918a 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -708,8 +708,14 @@ static u8 update_white_list(struct hci_request *req)
 		}
 
 		if (hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
-			/* White list can not be used with RPAs */
-			return 0x00;
+			/* White list can not be used with RPAs if address
+			 * resolution is disabled in the controller or the
+			 * peer device is not present in the resolving list.
+			 */
+			if (!hdev->le_ll_addr_resolve_enabled ||
+			    (!hci_resolving_list_lookup(hdev, &b->bdaddr,
+						       b->bdaddr_type)))
+				return 0x00;
 		}
 
 		white_list_entries++;
@@ -737,8 +743,14 @@ static u8 update_white_list(struct hci_request *req)
 
 		if (hci_find_irk_by_addr(hdev, &params->addr,
 					 params->addr_type)) {
-			/* White list can not be used with RPAs */
-			return 0x00;
+			/* White list can not be used with RPAs if address
+			 * resolution is disabled in the controller or the
+			 * peer device is not present in the resolving list.
+			 */
+			if (!hdev->le_ll_addr_resolve_enabled ||
+			    (!hci_resolving_list_lookup(hdev, &params->addr,
+						       params->addr_type)))
+				return 0x00;
 		}
 
 		white_list_entries++;
@@ -761,8 +773,14 @@ static u8 update_white_list(struct hci_request *req)
 
 		if (hci_find_irk_by_addr(hdev, &params->addr,
 					 params->addr_type)) {
-			/* White list can not be used with RPAs */
-			return 0x00;
+			/* White list can not be used with RPAs if address
+			 * resolution is disabled in the controller or the
+			 * peer device is not present in the resolving list.
+			 */
+			if (!hdev->le_ll_addr_resolve_enabled ||
+			    (!hci_resolving_list_lookup(hdev, &params->addr,
+						       params->addr_type)))
+				return 0x00;
 		}
 
 		white_list_entries++;
-- 
1.9.1


                 reply	other threads:[~2017-10-09  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=59db4697.d505630a.16da5.e54a@mx.google.com \
    --to=shermin.joy@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).