mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 15:32:41 +00:00
sm: fix race condition between local address changes and pairing procedure
Cahce address active for connection/advertisements on connection complete
This commit is contained in:
parent
6bcfa63272
commit
ba9fc86712
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- GAP: store link key in hci connection struct to allow authenticate after pairing without bonding
|
||||
- GAP: avoid requesting authentication twice
|
||||
- GAP: gap: cache own address on start advertising and connecting, provide getters
|
||||
- SM: fix race condition between local address changes and pairing procedure
|
||||
- ATT DB: fix spelling `gatt_server_get_handle_range_for_service_with_uuid128`, `gatt_server_get_handle_range_for_service_with_uuid16`
|
||||
|
||||
### Changed
|
||||
|
10
src/ble/sm.c
10
src/ble/sm.c
@ -3510,9 +3510,13 @@ static void sm_event_packet_handler (uint8_t packet_type, uint16_t channel, uint
|
||||
sm_conn->sm_role = packet[6];
|
||||
sm_conn->sm_peer_addr_type = packet[7];
|
||||
reverse_bd_addr(&packet[8], sm_conn->sm_peer_address);
|
||||
gap_le_get_own_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address);
|
||||
|
||||
log_info("New sm_conn, role %s", sm_conn->sm_role ? "slave" : "master");
|
||||
if (sm_conn->sm_role){
|
||||
// responder - use own address from advertisements
|
||||
gap_le_get_own_advertisements_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address);
|
||||
} else {
|
||||
// initiator - use own address from create connection
|
||||
gap_le_get_own_connection_address(&sm_conn->sm_own_addr_type, sm_conn->sm_own_address);
|
||||
}
|
||||
|
||||
// reset security properties
|
||||
sm_conn->sm_connection_encrypted = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user