}
#endif
- dev->att_mtu = MIN(mtu, BT_ATT_MAX_LE_MTU);
+ dev->att_mtu = MIN(mtu, main_opts.gatt_mtu);
attrib = g_attrib_new(io,
cid == ATT_CID ? BT_ATT_DEFAULT_LE_MTU : dev->att_mtu,
false);
#include "src/shared/gatt-server.h"
#include "log.h"
#include "error.h"
+#include "hcid.h"
#include "adapter.h"
#include "device.h"
#include "gatt-database.h"
BT_IO_OPT_SOURCE_BDADDR, addr,
BT_IO_OPT_PSM, ATT_PSM,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+ BT_IO_OPT_MTU, main_opts.gatt_mtu,
BT_IO_OPT_INVALID);
if (database->l2cap_io == NULL) {
error("Failed to start listening: %s", gerr->message);
#include "log.h"
#include "backtrace.h"
+#include "shared/att-types.h"
#include "lib/uuid.h"
#include "hcid.h"
#include "sdpd.h"
static const char *gatt_options[] = {
"Cache",
"MinEncKeySize",
+ "ExchangeMTU",
NULL
};
if (val >=7 && val <= 16)
main_opts.min_enc_key_size = val;
}
+
+ val = g_key_file_get_integer(config, "GATT", "ExchangeMTU", &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else {
+ /* Ensure the mtu is within a valid range. */
+ val = MIN(val, BT_ATT_MAX_LE_MTU);
+ val = MAX(val, BT_ATT_DEFAULT_LE_MTU);
+ DBG("ExchangeMTU=%d", val);
+ main_opts.gatt_mtu = val;
+ }
}
static void init_defaults(void)
main_opts.did_vendor = 0x1d6b; /* Linux Foundation */
main_opts.did_product = 0x0246; /* BlueZ */
main_opts.did_version = (major << 8 | minor);
+
+ main_opts.gatt_mtu = BT_ATT_MAX_LE_MTU;
#endif
}