Skip to content

Commit 2c6e41c

Browse files
sjancnashif
authored andcommitted
bluetooth: gatt: Fix ATT Read By Type by DB change unaware client
When change unaware client send ATT request it shall get Database Out of Sync error. Reading GATT database hash is an exception here. This was affecting GATT/SR/GAS/BV-05-C qualification test case. Signed-off-by: Szymon Janc <[email protected]> (cherry picked from commit 77cbd27)
1 parent 4404621 commit 2c6e41c

File tree

1 file changed

+17
-0
lines changed
  • subsys/bluetooth/host

1 file changed

+17
-0
lines changed

subsys/bluetooth/host/att.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,23 @@ static uint8_t att_read_type_req(struct bt_att_chan *chan, struct net_buf *buf)
15491549
return 0;
15501550
}
15511551

1552+
/* Reading Database Hash is special as it may be used to make client change aware
1553+
* (Core Specification 5.4 Vol 3. Part G. 2.5.2.1 Robust Caching).
1554+
*
1555+
* GATT client shall always use GATT Read Using Characteristic UUID sub-procedure for
1556+
* reading Database Hash
1557+
* (Core Specification 5.4 Vol 3. Part G. 7.3 Databse Hash)
1558+
*/
1559+
if (bt_uuid_cmp(&u.uuid, BT_UUID_GATT_DB_HASH) != 0) {
1560+
if (!bt_gatt_change_aware(chan->att->conn, true)) {
1561+
if (!atomic_test_and_set_bit(chan->flags, ATT_OUT_OF_SYNC_SENT)) {
1562+
return BT_ATT_ERR_DB_OUT_OF_SYNC;
1563+
} else {
1564+
return 0;
1565+
}
1566+
}
1567+
}
1568+
15521569
return att_read_type_rsp(chan, &u.uuid, start_handle, end_handle);
15531570
}
15541571

0 commit comments

Comments
 (0)