Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/2] ranging: Issue CS Security Enable based on the ACL role
@ 2026-10-27 14:09 Luiz Augusto von Dentz
  2026-10-27 14:09 ` [PATCH BlueZ v1 2/2] ranging: Fail CS Config Complete on role mismatch Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-27 14:09 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

CS Security Enable was only sent when the CS Config Complete reported the
local role as Initiator, and a CS Initiator that is the Peripheral of the
ACL moved to CS_STATE_HOLD, dropping all further CS events.

The CS Security Start procedure is tied to the ACL role instead
([Vol 6] Part B, 5.1.23: "The Link Layer of the Central initiates the CS
Security Start procedure", and [Vol 4] Part E, 7.8.133 disallows the
command when the Controller is the Peripheral), so send it whenever the
local device is the Central and wait for the event otherwise.

Fixes: 20cc88874d57 ("profiles: ranging: Add CS Initiator cmd and evt handling")
Assisted-by: OpenCode:claude-opus-5.5
---
 profiles/ranging/rap_hci.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/profiles/ranging/rap_hci.c b/profiles/ranging/rap_hci.c
index c472cedc9830..fee769e9b438 100644
--- a/profiles/ranging/rap_hci.c
+++ b/profiles/ranging/rap_hci.c
@@ -983,14 +983,8 @@ static void rap_cs_config_cmplt_evt(const void *data, uint8_t size,
 	cs_set_state(sm, CS_STATE_WAIT_SEC_CMPLT);
 
 	/* CS Security Enable may only be issued by the BLE Central */
-	if (rap_ev.role == 0x00) {
-		mapping = find_mapping_by_handle(sm, evt->handle);
-		if (!mapping || !mapping->is_central) {
-			error("CS Security Enable skipped: not BLE Central");
-			cs_set_state(sm, CS_STATE_HOLD);
-			return;
-		}
-
+	mapping = find_mapping_by_handle(sm, evt->handle);
+	if (mapping && mapping->is_central) {
 		if (bt_att_get_security(mapping->att, NULL) <
 						BT_ATT_SECURITY_MEDIUM) {
 			error("CS Security Enable skipped: not encrypted");
@@ -1001,8 +995,7 @@ static void rap_cs_config_cmplt_evt(const void *data, uint8_t size,
 		DBG("Central,encrypted: Sending CS Security Enable command");
 		rap_send_hci_cs_security_enable_command(sm, evt->handle);
 	} else {
-		/* Reflector role */
-		DBG("Reflector role: Waiting for security enable event...");
+		DBG("Peripheral: Waiting for security enable event...");
 	}
 
 	/* Send callback to RAP Profile */
-- 
2.56.0


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

end of thread, other threads:[~2026-10-28 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 14:09 [PATCH BlueZ v1 1/2] ranging: Issue CS Security Enable based on the ACL role Luiz Augusto von Dentz
2026-10-27 14:09 ` [PATCH BlueZ v1 2/2] ranging: Fail CS Config Complete on role mismatch Luiz Augusto von Dentz
2026-10-27 15:20 ` [BlueZ,v1,1/2] ranging: Issue CS Security Enable based on the ACL role bluez.test.bot
2026-10-28 13:30 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

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