monitor: Fix not loading local GATT DB from cache
Luiz Augusto von Dentz
maintainerPATCH 1/1 monitor: Fix not loading local GATT DB from cache
From: Luiz Augusto von Dentz <[email protected]>
The local GATT DB maybe discover in previous connection and therefore should be cached as well to be able to decode follow-up connections where the discovery may not be visible.
--- monitor/att.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
monitor/att.c +19 -4
@@ -412,12 +412,24 @@ static bool match_cache_id(const void *data, const void *match_data)return !bacmp (&cache->id, id); } -static void gatt_cache_add (struct packet_conn_data *conn,struct gatt_db *db) +static void gatt_cache_add (struct packet_conn_data *conn,struct gatt_db *ldb, +struct gatt_db *rdb) {struct gatt_cache *cache;bdaddr_t id;uint8_t id_type; +/* Attempt to cache local db if not empty */ +if (!gatt_db_isempty (ldb)) { + cache = new0(struct gatt_cache, 1); +bacpy (&cache->id, (bdaddr_t *)conn->src); + cache->db =gatt_db_ref (ldb); +queue_push_tail (cache_list, cache); + } + +if (gatt_db_isempty (rdb)) +return ; +if (!keys_resolve_identity (conn->dst, id.b, &id_type))bacpy (&id, (bdaddr_t *)conn->dst);
@@ -429,7 +441,7 @@ static void gatt_cache_add(struct packet_conn_data *conn, struct gatt_db *db) cache = new0(struct gatt_cache, 1);bacpy (&cache->id, &id); - cache->db =gatt_db_ref (db); + cache->db =gatt_db_ref (rdb);queue_push_tail (cache_list, cache); }
@@ -437,8 +449,7 @@ static void att_conn_data_free(struct packet_conn_data *conn, void *data) {struct att_conn_data *att_data = data; -if (!gatt_db_isempty (att_data->rdb)) -gatt_cache_add (conn, att_data->rdb); +gatt_cache_add (conn, att_data->ldb, att_data->rdb);gatt_db_unref (att_data->rdb);gatt_db_unref (att_data->ldb);
@@ -520,6 +531,10 @@ static void load_gatt_db(struct packet_conn_data *conn) cache =queue_find (cache_list, match_cache_id, &id);if (cache) data->rdb =gatt_db_ref (cache->db); + + cache =queue_find (cache_list, match_cache_id, &conn->src); +if (cache) + data->ldb =gatt_db_ref (cache->db); } }
Signature · 1 line
2.53.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1077784
---Test result---
Test Summary:
CheckPatch PENDING 0.32 seconds GitLint PENDING 0.36 seconds BuildEll PASS 20.56 seconds BluezMake PASS 655.19 seconds MakeCheck PASS 18.10 seconds MakeDistcheck PASS 243.21 seconds CheckValgrind PASS 297.43 seconds CheckSmatch PASS 349.29 seconds bluezmakeextell PASS 181.12 seconds IncrementalBuild PENDING 0.33 seconds ScanBuild PASS 1028.57 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
https://github.com/bluez/bluez/pull/2022/checks
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Mon, 6 Apr 2026 16:00:43 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
The local GATT DB maybe discover in previous connection and therefore should be cached as well to be able to decode follow-up connections where the discovery may not be visible.
--- monitor/att.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
Here is the summary with links:
- [BlueZ,v1] monitor: Fix not loading local GATT DB from cache
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a73fcbf207d3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html