Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2cac894 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi
Browse files

floss: Require ble privacy flag for resolving list

Currently, the `supports_ble_privacy` flag is only used to set the
privacy mode. However, this feature flag also affects whether the
resolving list can be used and should be protected by the same flag.

Bug: 253510389
Tag: #floss
Test: Run ChromeOS tests + verify resolving list not used.
Change-Id: Iae57bbb2874fab9b53f6df8d5598feeaa7c405ff
parent f8a6609f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ constexpr uint8_t PHY_LE_NO_PACKET = 0x00;
constexpr uint8_t PHY_LE_1M = 0x01;
constexpr uint8_t PHY_LE_2M = 0x02;
constexpr uint8_t PHY_LE_CODED = 0x04;
constexpr bool kEnableBlePrivacy = true;

static const std::string kPropertyMinConnInterval = "bluetooth.core.le.min_connection_interval";
static const std::string kPropertyMaxConnInterval = "bluetooth.core.le.max_connection_interval";
@@ -77,6 +78,7 @@ static const std::string kPropertyConnScanWindow2mFast = "bluetooth.core.le.conn
static const std::string kPropertyConnScanWindowCodedFast = "bluetooth.core.le.connection_scan_window_coded_fast";
static const std::string kPropertyConnScanIntervalSlow = "bluetooth.core.le.connection_scan_interval_slow";
static const std::string kPropertyConnScanWindowSlow = "bluetooth.core.le.connection_scan_window_slow";
static const std::string kPropertyEnableBlePrivacy = "bluetooth.core.gap.le.privacy.enabled";

enum class ConnectabilityState {
  DISARMED = 0,
@@ -996,7 +998,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
        address_policy,
        fixed_address,
        rotation_irk,
        controller_->SupportsBlePrivacy(),
        controller_->SupportsBlePrivacy() && os::GetSystemPropertyBool(kPropertyEnableBlePrivacy, kEnableBlePrivacy),
        minimum_rotation_time,
        maximum_rotation_time);
  }
+12 −0
Original line number Diff line number Diff line
@@ -435,6 +435,10 @@ void LeAddressManager::AddDeviceToResolvingList(
    Address peer_identity_address,
    const std::array<uint8_t, 16>& peer_irk,
    const std::array<uint8_t, 16>& local_irk) {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
@@ -473,6 +477,10 @@ void LeAddressManager::RemoveDeviceFromFilterAcceptList(

void LeAddressManager::RemoveDeviceFromResolvingList(
    PeerAddressType peer_identity_address_type, Address peer_identity_address) {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
@@ -502,6 +510,10 @@ void LeAddressManager::ClearFilterAcceptList() {
}

void LeAddressManager::ClearResolvingList() {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};