Bluetooth: Don't response with error to Exchange MTU req if MTU > 517

According to the Core Spec we shall respond to Exchange MTU Request
with MTU parameter set to the maximum MTU that we can receive.
As a Client, we shouldn't send an error if Server's Rx MTU exceeds
517 bytes. Whe should respond with our maximum MTU, because
after negotiation is done, ATT_MTU shall be set to the
minimum of the Client Rx MTU and Server Rx MTU values.

Error will be sent only in case of Rx MTU lower than LE default
ATT_MTU (23).

Change-Id: I9fa4f3fdb9b8129d52fc7b2557129c0894e5d201
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2015-10-14 16:16:05 +02:00 committed by Anas Nashif
commit de72c02645
2 changed files with 4 additions and 4 deletions

View file

@ -142,7 +142,8 @@ static uint8_t att_mtu_req(struct bt_conn *conn, struct bt_buf *buf)
BT_DBG("Client MTU %u\n", mtu);
if (mtu > BT_ATT_MAX_LE_MTU || mtu < BT_ATT_DEFAULT_LE_MTU) {
/* Check if MTU is valid */
if (mtu < BT_ATT_DEFAULT_LE_MTU) {
return BT_ATT_ERR_INVALID_PDU;
}
@ -205,8 +206,8 @@ static uint8_t att_mtu_rsp(struct bt_conn *conn, struct bt_buf *buf)
BT_DBG("Server MTU %u\n", mtu);
/* Check if MTU is within allowed range */
if (mtu > BT_ATT_MAX_LE_MTU || mtu < BT_ATT_DEFAULT_LE_MTU) {
/* Check if MTU is valid */
if (mtu < BT_ATT_DEFAULT_LE_MTU) {
return att_handle_rsp(conn, NULL, 0, BT_ATT_ERR_INVALID_PDU);
}

View file

@ -17,7 +17,6 @@
*/
#define BT_ATT_DEFAULT_LE_MTU 23
#define BT_ATT_MAX_LE_MTU 517
struct bt_att_hdr {
uint8_t code;