Skip to content

Commit 024de97

Browse files
VudentzAnas Nashif
authored andcommitted
Bluetooth: ATT: Respond with not support error for unknown PDUs
This ensures that an unknown request won't cause ATT to timeout since no response is currently generated. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent b7f6aaa commit 024de97

File tree

1 file changed

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

1 file changed

+9
-0
lines changed

subsys/bluetooth/host/att.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
BT_GATT_PERM_WRITE_ENCRYPT)
4343
#define BT_GATT_PERM_AUTHEN_MASK (BT_GATT_PERM_READ_AUTHEN | \
4444
BT_GATT_PERM_WRITE_AUTHEN)
45+
#define ATT_CMD_MASK 0x40
4546

4647
#define ATT_TIMEOUT K_SECONDS(30)
4748

@@ -1825,6 +1826,10 @@ static att_type_t att_op_get_type(u8_t op)
18251826
}
18261827
}
18271828

1829+
if (op & ATT_CMD_MASK) {
1830+
return ATT_COMMAND;
1831+
}
1832+
18281833
return ATT_UNKNOWN;
18291834
}
18301835

@@ -1854,6 +1859,10 @@ static void bt_att_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
18541859

18551860
if (!handler) {
18561861
BT_WARN("Unknown ATT code 0x%02x", hdr->code);
1862+
if (att_op_get_type(hdr->code) != ATT_COMMAND) {
1863+
send_err_rsp(chan->conn, hdr->code, 0,
1864+
BT_ATT_ERR_NOT_SUPPORTED);
1865+
}
18571866
return;
18581867
}
18591868

0 commit comments

Comments
 (0)