* [PATCH BlueZ v3 1/2] shared/att: Confirm indications without a registered handler
@ 2026-11-23 17:12 Simon Mikuda
2026-11-23 17:12 ` [PATCH BlueZ v3 2/2] unit/test-gatt: Add test for indication without a handler Simon Mikuda
2026-11-24 2:05 ` [BlueZ,v3,1/2] shared/att: Confirm indications without a registered handler bluez.test.bot
0 siblings, 2 replies; 3+ messages in thread
From: Simon Mikuda @ 2026-11-23 17:12 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)
bt_att never confirms an indication itself: the GATT client's
indication handler does. When no handler is registered, send the
confirmation from bt_att on the channel the indication arrived on.
With a GATT client attached nothing changes, its handler still sends
the confirmation.
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..10ac4a3c4 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] 3+ messages in thread
* [PATCH BlueZ v3 2/2] unit/test-gatt: Add test for indication without a handler
2026-11-23 17:12 [PATCH BlueZ v3 1/2] shared/att: Confirm indications without a registered handler Simon Mikuda
@ 2026-11-23 17:12 ` Simon Mikuda
2026-11-24 2:05 ` [BlueZ,v3,1/2] shared/att: Confirm indications without a registered handler bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: Simon Mikuda @ 2026-11-23 17:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
A server with no GATT client on the bearer has nothing registered for
Handle Value Indication. Check that it answers one with a Handle Value
Confirmation instead of an Error Response.
Assisted-by: Claude:claude-opus-5-5
---
unit/test-gatt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 3a35ccbc1..a4f03644e 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -5205,6 +5205,12 @@ int main(int argc, char *argv[])
raw_pdu(0xff, 0x00),
raw_pdu());
+ define_test_server("/robustness/indication-no-handler",
+ test_server, service_db_1, NULL,
+ raw_pdu(0x03, 0x00, 0x02),
+ raw_pdu(0x1d, 0x08, 0x00, 0x01, 0x00, 0xff, 0xff),
+ raw_pdu(0x1e));
+
define_test_client("/robustness/client-mtu-rsp-short", test_client,
NULL, &test_client_init_fail,
raw_pdu(0x02, 0x00, 0x02),
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ,v3,1/2] shared/att: Confirm indications without a registered handler
2026-11-23 17:12 [PATCH BlueZ v3 1/2] shared/att: Confirm indications without a registered handler Simon Mikuda
2026-11-23 17:12 ` [PATCH BlueZ v3 2/2] unit/test-gatt: Add test for indication without a handler Simon Mikuda
@ 2026-11-24 2:05 ` bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-11-24 2:05 UTC (permalink / raw)
To: linux-bluetooth, simon.mikuda
[-- Attachment #1: Type: text/plain, Size: 1023 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/1219879/
---Test result---
Test Summary:
CheckPatch PASS 0.95 seconds
GitLint PASS 0.65 seconds
BuildEll PASS 20.69 seconds
BluezMake PASS 311.67 seconds
MakeCheck PASS 14.47 seconds
MakeDistcheck PASS 147.63 seconds
CheckValgrind PASS 356.31 seconds
CheckSmatch PASS 318.13 seconds
bluezmakeextell PASS 100.95 seconds
TestFunctional PASS 1227.69 seconds
IncrementalBuild PASS 348.55 seconds
ScanBuild PASS 1205.34 seconds
https://github.com/bluez/bluez/pull/2888
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 2:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 17:12 [PATCH BlueZ v3 1/2] shared/att: Confirm indications without a registered handler Simon Mikuda
2026-11-23 17:12 ` [PATCH BlueZ v3 2/2] unit/test-gatt: Add test for indication without a handler Simon Mikuda
2026-11-24 2:05 ` [BlueZ,v3,1/2] shared/att: Confirm indications without a registered handler 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