summaryrefslogtreecommitdiff
path: root/android/gatt.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-02-07 16:18:16 +0100
committerSzymon Janc <szymon.janc@tieto.com>2015-02-09 13:32:10 +0100
commit518a0d9f7b7cf15e71e5546e2a17d591010f58f9 (patch)
treec4a3811f4dbf8d240a17ca9222068e4ad16f1fb8 /android/gatt.c
parent23a4b8af8b38058fb2249fbb8a941235d233f473 (diff)
downloadbluez-518a0d9f7b7cf15e71e5546e2a17d591010f58f9.tar.gz
android/gatt: Disconnect ATT if MTU is too small on BR/EDR
On BR/EDR MTU is negotiated using L2CAP configuration and not by ATT MTU exchange procedure.
Diffstat (limited to 'android/gatt.c')
-rw-r--r--android/gatt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/android/gatt.c b/android/gatt.c
index 49fff6f60..45d70fdcf 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1519,6 +1519,14 @@ static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
goto reply;
}
+ /* on BR/EDR MTU must not be less then minimal allowed MTU */
+ if (cid != ATT_CID && mtu < ATT_DEFAULT_L2CAP_MTU) {
+ error("gatt: MTU too small (%u bytes)", mtu);
+ device_set_state(dev, DEVICE_DISCONNECTED);
+ status = GATT_FAILURE;
+ goto reply;
+ }
+
DBG("mtu %u cid %u", mtu, cid);
/* on LE we always start with default MTU */