mirror of https://github.com/ARMmbed/mbed-os.git
filter based on resolving list size
parent
457268825d
commit
ec2808be31
|
@ -2555,6 +2555,13 @@ void Gap::signal_advertising_report(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
/* filter out unresolved address if at least one bond exists */
|
||||||
|
if (_address_registry.read_resolving_list_size() > 0 &&
|
||||||
|
_central_privacy_configuration.resolution_strategy == central_privacy_configuration_t::RESOLVE_AND_FILTER &&
|
||||||
|
event.getPeerAddressType() != peer_address_type_t::PUBLIC &&
|
||||||
|
is_random_private_resolvable_address(event.getPeerAddress())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_event_handler->onAdvertisingReport(
|
_event_handler->onAdvertisingReport(
|
||||||
event
|
event
|
||||||
);
|
);
|
||||||
|
@ -2572,15 +2579,15 @@ void Gap::conclude_signal_advertising_report_after_address_resolution(
|
||||||
{
|
{
|
||||||
/* fix the report with the new address if there's an identity found */
|
/* fix the report with the new address if there's an identity found */
|
||||||
if (identity_address) {
|
if (identity_address) {
|
||||||
/* filter out resolved address based on policy */
|
|
||||||
if (_central_privacy_configuration.resolution_strategy ==
|
|
||||||
central_privacy_configuration_t::RESOLVE_AND_FILTER) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.setPeerAddress(*identity_address);
|
event.setPeerAddress(*identity_address);
|
||||||
event.setPeerAddressType(identity_address_type == target_peer_address_type_t::RANDOM ?
|
event.setPeerAddressType(identity_address_type == target_peer_address_type_t::RANDOM ?
|
||||||
peer_address_type_t::RANDOM_STATIC_IDENTITY
|
peer_address_type_t::RANDOM_STATIC_IDENTITY
|
||||||
: peer_address_type_t::PUBLIC_IDENTITY);
|
: peer_address_type_t::PUBLIC_IDENTITY);
|
||||||
|
} else if (_central_privacy_configuration.resolution_strategy ==
|
||||||
|
central_privacy_configuration_t::RESOLVE_AND_FILTER &&
|
||||||
|
_address_registry.read_resolving_list_size() > 0) {
|
||||||
|
/* filter out unresolved address if at least one bond exists */
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_event_handler->onAdvertisingReport(event);
|
_event_handler->onAdvertisingReport(event);
|
||||||
|
|
|
@ -155,6 +155,11 @@ uint8_t PrivateAddressController::read_resolving_list_capacity()
|
||||||
#endif //BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
#endif //BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t PrivateAddressController::read_resolving_list_size()
|
||||||
|
{
|
||||||
|
return _resolving_list_size;
|
||||||
|
}
|
||||||
|
|
||||||
ble_error_t PrivateAddressController::add_device_to_resolving_list(
|
ble_error_t PrivateAddressController::add_device_to_resolving_list(
|
||||||
target_peer_address_type_t peer_address_type,
|
target_peer_address_type_t peer_address_type,
|
||||||
const address_t &peer_identity_address,
|
const address_t &peer_identity_address,
|
||||||
|
@ -185,6 +190,7 @@ ble_error_t PrivateAddressController::add_device_to_resolving_list(
|
||||||
entry.peer_irk = peer_irk;
|
entry.peer_irk = peer_irk;
|
||||||
entry.populated = true;
|
entry.populated = true;
|
||||||
entry_added = true;
|
entry_added = true;
|
||||||
|
_resolving_list_size++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,6 +240,7 @@ ble_error_t PrivateAddressController::remove_device_from_resolving_list(
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.populated = false;
|
entry.populated = false;
|
||||||
|
_resolving_list_size--;
|
||||||
|
|
||||||
restart_resolution_process_on_host();
|
restart_resolution_process_on_host();
|
||||||
}
|
}
|
||||||
|
@ -259,6 +266,7 @@ ble_error_t PrivateAddressController::clear_resolving_list()
|
||||||
remove_resolution_entry_from_cache([&](resolution_entry_t& entry) {
|
remove_resolution_entry_from_cache([&](resolution_entry_t& entry) {
|
||||||
return entry.identity != nullptr;
|
return entry.identity != nullptr;
|
||||||
});
|
});
|
||||||
|
_resolving_list_size = 0;
|
||||||
|
|
||||||
restart_resolution_process_on_host();
|
restart_resolution_process_on_host();
|
||||||
|
|
||||||
|
@ -380,6 +388,7 @@ struct PrivateAddressController::PrivacyAddDevToResListControlBlock final :
|
||||||
_peer_irk,
|
_peer_irk,
|
||||||
self._local_irk
|
self._local_irk
|
||||||
);
|
);
|
||||||
|
self._resolving_list_size++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +437,7 @@ struct PrivateAddressController::PrivacyRemoveDevFromResListControlBlock final :
|
||||||
_peer_identity_address_type,
|
_peer_identity_address_type,
|
||||||
_peer_identity_address
|
_peer_identity_address
|
||||||
);
|
);
|
||||||
|
self._resolving_list_size--;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +474,7 @@ struct PrivateAddressController::PrivacyClearResListControlBlock final :
|
||||||
{
|
{
|
||||||
// Execute command
|
// Execute command
|
||||||
self._pal.clear_resolving_list();
|
self._pal.clear_resolving_list();
|
||||||
|
self._resolving_list_size = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -148,10 +148,15 @@ public:
|
||||||
#endif //!BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
#endif //!BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the number of entry that can be put in the resolving list.
|
* Read the number of entries that can be put in the resolving list.
|
||||||
*/
|
*/
|
||||||
uint8_t read_resolving_list_capacity();
|
uint8_t read_resolving_list_capacity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the number of entries that are in the resolving list.
|
||||||
|
*/
|
||||||
|
uint8_t read_resolving_list_size();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new peer to the resolving list.
|
* Add a new peer to the resolving list.
|
||||||
* @param peer_address_type The type of the peer's identity address.
|
* @param peer_address_type The type of the peer's identity address.
|
||||||
|
@ -313,6 +318,8 @@ private:
|
||||||
PrivacyControlBlock *_pending_privacy_control_blocks = nullptr;
|
PrivacyControlBlock *_pending_privacy_control_blocks = nullptr;
|
||||||
bool _processing_privacy_control_block = false;
|
bool _processing_privacy_control_block = false;
|
||||||
|
|
||||||
|
uint8_t _resolving_list_size = 0;
|
||||||
|
|
||||||
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
|
||||||
struct resolving_list_entry_t {
|
struct resolving_list_entry_t {
|
||||||
address_t peer_address = {};
|
address_t peer_address = {};
|
||||||
|
|
Loading…
Reference in New Issue