hci: skip resolving list management if not supported by controller

This commit is contained in:
Matthias Ringwald 2020-10-16 17:17:24 +02:00
parent 57132f1279
commit ea1519740b

View File

@ -3670,7 +3670,8 @@ static bool hci_run_general_gap_le(void){
// check if resolving list needs modification
bool resolving_list_modification_pending = false;
#ifdef ENABLE_LE_PRIVACY_ADDRESS_RESOLUTION
if (hci_stack->le_resolving_list_state != LE_RESOLVING_LIST_DONE){
bool resolving_list_supported = (hci_stack->local_supported_commands[1] & (1 << 2)) != 0;
if (resolving_list_supported && hci_stack->le_resolving_list_state != LE_RESOLVING_LIST_DONE){
resolving_list_modification_pending = true;
}
#endif
@ -3837,27 +3838,23 @@ static bool hci_run_general_gap_le(void){
#ifdef ENABLE_LE_PRIVACY_ADDRESS_RESOLUTION
// LE Resolving List Management
if (resolving_list_supported) {
uint16_t i;
switch (hci_stack->le_resolving_list_state) {
case LE_RESOLVING_LIST_SEND_ENABLE_ADDRESS_RESOLUTION:
// check if supported
if ((hci_stack->local_supported_commands[1] & (1 << 2)) == 0){
log_info("LE Address Resolution not supported");
break;
} else {
hci_stack->le_resolving_list_state = LE_RESOLVING_LIST_READ_SIZE;
hci_send_cmd(&hci_le_set_address_resolution_enabled, 1);
return true;
}
break;
case LE_RESOLVING_LIST_READ_SIZE:
hci_stack->le_resolving_list_state = LE_RESOLVING_LIST_SEND_CLEAR;
hci_send_cmd(&hci_le_read_resolving_list_size);
return true;
case LE_RESOLVING_LIST_SEND_CLEAR:
hci_stack->le_resolving_list_state = LE_RESOLVING_LIST_REMOVE_ENTRIES;
(void) memset(hci_stack->le_resolving_list_add_entries, 0xff, sizeof(hci_stack->le_resolving_list_add_entries));
(void) memset(hci_stack->le_resolving_list_remove_entries, 0, sizeof(hci_stack->le_resolving_list_remove_entries));
(void) memset(hci_stack->le_resolving_list_add_entries, 0xff,
sizeof(hci_stack->le_resolving_list_add_entries));
(void) memset(hci_stack->le_resolving_list_remove_entries, 0,
sizeof(hci_stack->le_resolving_list_remove_entries));
hci_send_cmd(&hci_le_clear_resolving_list);
return true;
case LE_RESOLVING_LIST_REMOVE_ENTRIES:
@ -3884,7 +3881,8 @@ static bool hci_run_general_gap_le(void){
}
#endif
hci_send_cmd(&hci_le_remove_device_from_resolving_list, peer_identity_addr_type, peer_identity_addreses);
hci_send_cmd(&hci_le_remove_device_from_resolving_list, peer_identity_addr_type,
peer_identity_addreses);
return true;
}
@ -3909,7 +3907,8 @@ static bool hci_run_general_gap_le(void){
uint8_t peer_irk_flipped[16];
reverse_128(local_irk, local_irk_flipped);
reverse_128(peer_irk, peer_irk_flipped);
hci_send_cmd(&hci_le_add_device_to_resolving_list, peer_identity_addr_type, peer_identity_addreses, peer_irk_flipped, local_irk_flipped);
hci_send_cmd(&hci_le_add_device_to_resolving_list, peer_identity_addr_type, peer_identity_addreses,
peer_irk_flipped, local_irk_flipped);
return true;
}
hci_stack->le_resolving_list_state = LE_RESOLVING_LIST_DONE;
@ -3918,6 +3917,7 @@ static bool hci_run_general_gap_le(void){
default:
break;
}
}
hci_stack->le_resolving_list_state = LE_RESOLVING_LIST_DONE;
#endif