From 518a0d9f7b7cf15e71e5546e2a17d591010f58f9 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Sat, 7 Feb 2015 16:18:16 +0100 Subject: [PATCH] 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. --- android/gatt.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 */ -- 2.47.3