sm: observe role change

This commit is contained in:
Matthias Ringwald 2024-07-04 11:26:45 +02:00
parent 20964aa9e7
commit d44cdc4aa1
2 changed files with 12 additions and 2 deletions

View File

@ -13,8 +13,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- RFCOMM: shut down multiplexer after closing last channel instead of multiplexer idle timer
- HID Host: return complete HID report
- SM: fix CTDK key distribution over BR/EDR
- SM: fix CTKD key distribution over BR/EDR
- SM: fix CTKD after BR/EDR Role Change
### Changed
- GAP: return command disallowed if disconnect already requested

View File

@ -3796,6 +3796,7 @@ static void sm_event_handle_classic_encryption_event(sm_connection_t * sm_conn,
if (sm_conn->sm_connection_encrypted != 2) return;
// prepare for pairing request
if (IS_RESPONDER(sm_conn->sm_role)){
log_info("CTKD: SM_BR_EDR_RESPONDER_W4_PAIRING_REQUEST");
sm_conn->sm_engine_state = SM_BR_EDR_RESPONDER_W4_PAIRING_REQUEST;
} else if (sm_conn->sm_pairing_requested){
// check if remote supports fixed channels
@ -3914,6 +3915,14 @@ static void sm_event_packet_handler (uint8_t packet_type, uint16_t channel, uint
sm_conn->sm_cid = L2CAP_CID_BR_EDR_SECURITY_MANAGER;
sm_conn->sm_engine_state = SM_BR_EDR_W4_ENCRYPTION_COMPLETE;
break;
case HCI_EVENT_ROLE_CHANGE:
// needed
hci_event_role_change_get_bd_addr(packet, addr);
sm_conn = sm_get_connection_for_bd_addr_and_type(addr, BD_ADDR_TYPE_ACL);
if (sm_conn == NULL) break;
sm_conn->sm_role = hci_event_role_change_get_role(packet);
break;
#endif
#ifdef ENABLE_CROSS_TRANSPORT_KEY_DERIVATION