Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/att: Confirm indications without a registered handler
@ 2026-11-22 10:35 Simon Mikuda
  2026-11-22 18:30 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 10:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

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:

> 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)
...
> 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(-)

diff --git a/src/shared/att.c b/src/shared/att.c
index 366ee83d8..bf869cc81 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [BlueZ] shared/att: Confirm indications without a registered handler
  2026-11-22 10:35 [PATCH BlueZ] shared/att: Confirm indications without a registered handler Simon Mikuda
@ 2026-11-22 18:30 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-22 18:30 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]

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/1218568/

---Test result---

Test Summary:
CheckPatch                    FAIL      0.38 seconds
GitLint                       PASS      0.25 seconds
BuildEll                      PASS      13.88 seconds
BluezMake                     PASS      185.34 seconds
MakeCheck                     PASS      0.76 seconds
MakeDistcheck                 PASS      112.70 seconds
CheckValgrind                 PASS      111.95 seconds
CheckSmatch                   PASS      197.85 seconds
bluezmakeextell               PASS      68.89 seconds
TestFunctional                PASS      923.61 seconds
IncrementalBuild              PASS      195.72 seconds
ScanBuild                     PASS      654.28 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] shared/att: Confirm indications without a registered handler
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#174: FILE: src/shared/att.c:1098:
+								NULL, NULL, NULL);

/home/runner/work/bluez/bluez/src/patch/15010044.patch total: 0 errors, 1 warnings, 25 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/home/runner/work/bluez/bluez/src/patch/15010044.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




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

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-22 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 10:35 [PATCH BlueZ] shared/att: Confirm indications without a registered handler Simon Mikuda
2026-11-22 18:30 ` [BlueZ] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox