att: Return error in case Exchange MTU is used over BR/EDR link
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 3 Jul 2019 15:32:37 +0000 (18:32 +0300)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
In case of BR/EDR the L2CAP MTU negotion is used instead:

  BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2370
  4.3.1 Exchange MTU

  This sub-procedure shall not be used on a BR/EDR physical link since
  the MTU size is negotiated using L2CAP channel configuration
  procedures.

Change-Id: Iadcd6d11ad30f892661da0e9e58993fa2e4e987b
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/shared/att.c

index 1d61434..1186803 100755 (executable)
@@ -858,6 +858,22 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
                if (!opcode_match(notify->opcode, opcode))
                        continue;
 
+               /* BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G
+                * page 2370
+                *
+                * 4.3.1 Exchange MTU
+                *
+                * This sub-procedure shall not be used on a BR/EDR physical
+                * link since the MTU size is negotiated using L2CAP channel
+                * configuration procedures.
+                */
+               if (bt_att_get_link_type(att) == BT_ATT_LINK_BREDR) {
+                       switch (opcode) {
+                       case BT_ATT_OP_MTU_REQ:
+                               goto not_supported;
+                       }
+               }
+
                found = true;
 
                if (notify->callback)
@@ -869,6 +885,7 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
                        break;
        }
 
+not_supported:
        /*
         * If this was not a command and no handler was registered for it,
         * respond with "Not Supported"