Skip to content

Commit 98928c0

Browse files
Chang Kimfabiobaltieri
authored andcommitted
bluetooth: host: Add conditions to ATT_READ_BY_TYPE_REQ handler
Core spec V5.4 Vol. 3 Part G 2.5.2.1 Robust Caching specifies the conditions where Database Out Of Sync (0x12) error needs to be returned as follows: If a client that has indicated support for robust caching (by setting the Robust Caching bit in the Client Supported Features characteristic) is change-unaware then the server shall send an ATT_ERROR_RSP PDU with the Error Code parameter set to Database Out Of Sync (0x12) when either of the following happen: • That client requests an operation at any Attribute Handle or list of Attribute Handles by sending an ATT request. • That client sends an ATT_READ_BY_TYPE_REQ PDU with Attribute Type other than «Include» or «Characteristic» and an Attribute Handle range other than 0x0001 to 0xFFFF. Add the conditions to ATT_READ_BY_TYPE_REQ handler. Signed-off-by: Chang Kim <[email protected]>
1 parent 424c187 commit 98928c0

File tree

1 file changed

+14
-7
lines changed
  • subsys/bluetooth/host

1 file changed

+14
-7
lines changed

subsys/bluetooth/host/att.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,15 +1548,22 @@ static uint8_t att_read_type_req(struct bt_att_chan *chan, struct net_buf *buf)
15481548
return 0;
15491549
}
15501550

1551-
/* Reading Database Hash is special as it may be used to make client change aware
1551+
/* If a client that has indicated support for robust caching (by setting the Robust
1552+
* Caching bit in the Client Supported Features characteristic) is change-unaware
1553+
* then the server shall send an ATT_ERROR_RSP PDU with the Error Code
1554+
* parameter set to Database Out Of Sync (0x12) when either of the following happen:
1555+
* • That client requests an operation at any Attribute Handle or list of Attribute
1556+
* Handles by sending an ATT request.
1557+
* • That client sends an ATT_READ_BY_TYPE_REQ PDU with Attribute Type
1558+
* other than «Include» or «Characteristic» and an Attribute Handle range
1559+
* other than 0x0001 to 0xFFFF.
15521560
* (Core Specification 5.4 Vol 3. Part G. 2.5.2.1 Robust Caching).
1553-
*
1554-
* GATT client shall always use GATT Read Using Characteristic UUID sub-procedure for
1555-
* reading Database Hash
1556-
* (Core Specification 5.4 Vol 3. Part G. 7.3 Databse Hash)
15571561
*/
1558-
if (bt_uuid_cmp(&u.uuid, BT_UUID_GATT_DB_HASH) != 0) {
1559-
if (!bt_gatt_change_aware(chan->att->conn, true)) {
1562+
if (!bt_gatt_change_aware(chan->chan.chan.conn, true)) {
1563+
if (bt_uuid_cmp(&u.uuid, BT_UUID_GATT_INCLUDE) != 0 &&
1564+
bt_uuid_cmp(&u.uuid, BT_UUID_GATT_CHRC) != 0 &&
1565+
(start_handle != BT_ATT_FIRST_ATTRIBUTE_HANDLE ||
1566+
end_handle != BT_ATT_LAST_ATTRIBUTE_HANDLE)) {
15601567
if (!atomic_test_and_set_bit(chan->flags, ATT_OUT_OF_SYNC_SENT)) {
15611568
return BT_ATT_ERR_DB_OUT_OF_SYNC;
15621569
} else {

0 commit comments

Comments
 (0)