Linux bluetooth development
 help / color / mirror / Atom feed
From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ 3/8] device: Don't override the ATT MTU over BR/EDR
Date: Tue, 24 Nov 2026 15:46:37 +0100	[thread overview]
Message-ID: <20261124144642.298366-4-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261124144642.298366-1-simon.mikuda@streamunlimited.com>

device_attach_att() sets the ATT_MTU of a BR/EDR channel to our incoming
L2CAP MTU, as g_attrib_new() did before commit 9d09a446ace8 ("device:
Use bt_att instead of GAttrib"). The ATT_MTU is the smaller of the two
MTUs of the channel (Core Vol 3, Part G, 5.1.1), so when the remote's
incoming MTU is smaller, bluetoothd sends PDUs it can't take.

On the remote, paired over BR/EDR:

  btgatt-client -t bredr -d <address> -m 48
  [GATT client]# services

The discovery never completes, and bluetoothd logs:

  bt_att_chan_write() (chan 0x...) write failed: Message too long

bt_att already uses the smaller MTU: leave it.

Fixes: e758ebb6a144 ("src/device.c : Fix BREDR-ATT MTU issue")
Assisted-by: Claude:claude-opus-5-5
---
 src/device.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/device.c b/src/device.c
index 36a980d1e..be3267368 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6670,14 +6670,12 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io)
 	struct bt_att *att;
 	BtIOSecLevel sec_level;
 	uint16_t mtu;
-	uint16_t cid;
 	struct btd_gatt_database *database;
 	const bdaddr_t *dst;
 	char dstaddr[18];
 
 	bt_io_get(io, &gerr, BT_IO_OPT_SEC_LEVEL, &sec_level,
 						BT_IO_OPT_IMTU, &mtu,
-						BT_IO_OPT_CID, &cid,
 						BT_IO_OPT_INVALID);
 
 	if (gerr) {
@@ -6724,13 +6722,6 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io)
 		return false;
 	}
 
-	if (!bt_att_set_mtu(att, cid == BT_ATT_CID ? BT_ATT_DEFAULT_LE_MTU :
-							dev->att_mtu)) {
-		error("Unable to set ATT MTU");
-		bt_att_unref(att);
-		return false;
-	}
-
 	/* The fd is closed once the ATT instance is freed */
 	g_io_channel_set_close_on_unref(io, FALSE);
 
-- 
2.43.0


  parent reply	other threads:[~2026-11-24 14:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:46 [PATCH BlueZ 0/8] Fix GATT over BR/EDR Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 1/8] tools/btgatt-client: Add BR/EDR support Simon Mikuda
2026-11-24 20:44   ` Fix GATT over BR/EDR bluez.test.bot
2026-11-24 14:46 ` [PATCH BlueZ 2/8] shared/att: Use the smaller L2CAP MTU as ATT MTU Simon Mikuda
2026-11-24 14:46 ` Simon Mikuda [this message]
2026-11-24 14:46 ` [PATCH BlueZ 4/8] device: Don't resolve services on GATT over BR/EDR Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 5/8] gatt-client: Don't connect EATT on an ATT bearer " Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 6/8] profiles: Set the LE bearer for TMAP, GMAP and RAP Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 7/8] device: Don't accept LE profiles over ATT on BR/EDR Simon Mikuda
2026-11-24 14:46 ` [PATCH BlueZ 8/8] device: Connect GATT over BR/EDR with ConnectProfile Simon Mikuda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124144642.298366-4-simon.mikuda@streamunlimited.com \
    --to=simon.mikuda@streamunlimited.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox