Skip to contentSkip to conversation

shared/att: Confirm indications without a registered handler

PATCH Superseded Simon Mikuda 3 participants 3 messages Nov 22 – Nov 23 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 shared/att: Confirm indications without a registered handler

When no GATT client is attached to the bearer nothing registers for Handle Value Indication, so handle_notify() answers it with an Error Response. That is not a valid reply to an indication (Core Vol 3, Part F, 3.4.7.2 allows only a Handle Value Confirmation): the peer keeps waiting for the confirmation and drops the link when its 30 second ATT transaction timeout expires.

This happens on incoming connections when ReverseServiceDiscovery or [GATT] Client is disabled in main.conf. iOS sends Service Changed as the first PDU on every bonded reconnect:

Quoted 1 line

ACL Data RX: Handle 64 flags 0x02 dlen 11

      ATT: Handle Value Indication (0x1d) len 6
        Handle: 0x0008
          Data: 0a00ffff
< ACL Data TX: Handle 64 flags 0x00 dlen 9
      ATT: Error Response (0x01) len 4
        Handle Value Indication (0x1d)
        Handle: 0x0000
        Error: Request Not Supported (0x06)

...

Quoted 1 line

HCI Event: Disconnect Complete (0x05) plen 4 #113 34.912832

        Status: Success (0x00)
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)

Send the confirmation on the bearer the indication arrived on when no handler is registered. With a GATT client attached it confirms as before.

Assisted-by Claude:claude-opus-5-5
---
 src/shared/att.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
src/shared/att.c +13 -6
index 366ee83d8..10ac4a3c4 100644
@@ -1086,12 +1086,19 @@ static void handle_notify(struct bt_att_chan *chan, uint8_t *pdu,
 	}
 
 not_supported:
-	/*
-	 * If this was not a command and no handler was registered for it,
-	 * respond with "Not Supported"
-	 */
-	if (!found && get_op_type(opcode) != ATT_OP_TYPE_CMD)
-		respond_not_supported(att, opcode);
+	if (!found) {
+		/*
+		 * An indication can only be answered with a confirmation, an
+		 * Error Response leaves the peer waiting until its ATT
+		 * transaction times out. If this was not a command and no
+		 * handler was registered for it, respond with "Not Supported".
+		 */
+		if (opcode == BT_ATT_OP_HANDLE_IND)
+			bt_att_chan_send(chan, BT_ATT_OP_HANDLE_CONF, NULL, 0,
+						NULL, NULL, NULL);
+		else if (get_op_type(opcode) != ATT_OP_TYPE_CMD)
+			respond_not_supported(att, opcode);
+	}
 
 	bt_att_unref(att);
 }

base-commit: 1adfe662efeff12997df9ddd0960dbd0de9c8ea7

Signature · 1 line
2.43.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1218925/

---Test result---

Test Summary:

CheckPatch                    PASS      0.23 seconds
GitLint                       PASS      0.16 seconds
BuildEll                      PASS      13.15 seconds
BluezMake                     PASS      201.14 seconds
MakeCheck                     PASS      0.66 seconds
MakeDistcheck                 PASS      105.12 seconds
CheckValgrind                 PASS      110.99 seconds
CheckSmatch                   PASS      184.07 seconds
bluezmakeextell               PASS      66.28 seconds
TestFunctional                PASS      922.66 seconds
IncrementalBuild              PASS      206.79 seconds
ScanBuild                     PASS      710.38 seconds

https://github.com/bluez/bluez/pull/2876

---
Regards,
Linux Bluetooth

#2 lore raw

Hi Simon,

Quoted 27 lines · On Sun, Nov 22, 2026 at 6:36 PM <[email protected]> wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1218925/

---Test result---

Test Summary:

CheckPatch                    PASS      0.23 seconds
GitLint                       PASS      0.16 seconds
BuildEll                      PASS      13.15 seconds
BluezMake                     PASS      201.14 seconds
MakeCheck                     PASS      0.66 seconds
MakeDistcheck                 PASS      105.12 seconds
CheckValgrind                 PASS      110.99 seconds
CheckSmatch                   PASS      184.07 seconds
bluezmakeextell               PASS      66.28 seconds
TestFunctional                PASS      922.66 seconds
IncrementalBuild              PASS      206.79 seconds
ScanBuild                     PASS      710.38 seconds
Quoted 5 lines

https://github.com/bluez/bluez/pull/2876

---
Regards,
Linux Bluetooth

Copilot raised a fair point: there is no test that covers this situation:

https://github.com/bluez/bluez/pull/2876#pullrequestreview-6023405971

Signature · 1 line
Luiz Augusto von Dentz