public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] monitor/att: Fix not loading gatt_db for devices using RPA
Date: Fri, 24 Mar 2023 16:38:55 -0700	[thread overview]
Message-ID: <20230324233856.3693370-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20230324233856.3693370-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Device using RPA have its storage using its identity address so this
uses keys_resolve_identity to attempt to resolve the destination
address instead of always using the connection address.
---
 monitor/att.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/monitor/att.c b/monitor/att.c
index 42d1afe701a1..cf440c6844c0 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -42,6 +42,7 @@
 #include "display.h"
 #include "l2cap.h"
 #include "att.h"
+#include "keys.h"
 
 struct att_read {
 	struct gatt_db_attribute *attr;
@@ -2885,9 +2886,14 @@ static void load_gatt_db(struct packet_conn_data *conn)
 	char filename[PATH_MAX];
 	char local[18];
 	char peer[18];
+	uint8_t id[6], id_type;
 
 	ba2str((bdaddr_t *)conn->src, local);
-	ba2str((bdaddr_t *)conn->dst, peer);
+
+	if (keys_resolve_identity(conn->dst, id, &id_type))
+		ba2str((bdaddr_t *)id, peer);
+	else
+		ba2str((bdaddr_t *)conn->dst, peer);
 
 	create_filename(filename, PATH_MAX, "/%s/attributes", local);
 	gatt_load_db(data->ldb, filename, &data->ldb_mtim);
-- 
2.39.2


  parent reply	other threads:[~2023-03-24 23:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 23:38 [PATCH BlueZ 1/4] shared/gatt-db: Make gatt_db_attribute_get_value public Luiz Augusto von Dentz
2023-03-24 23:38 ` [PATCH BlueZ 2/4] monitor/att: Print value when printing descriptors Luiz Augusto von Dentz
2023-03-24 23:38 ` Luiz Augusto von Dentz [this message]
2023-03-24 23:38 ` [PATCH BlueZ 4/4] monitor: Cache IRK being parsed Luiz Augusto von Dentz
2023-03-25  2:27 ` [BlueZ,1/4] shared/gatt-db: Make gatt_db_attribute_get_value public bluez.test.bot
2023-03-27 21:20 ` [PATCH BlueZ 1/4] " patchwork-bot+bluetooth

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=20230324233856.3693370-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@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