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

Commit 21ff352b authored by David Duarte's avatar David Duarte Committed by Charlie Boutier
Browse files

RootCanal: Only remove BR_EDR links from LMP

Test: gd/cert/run LeAclManagerTest
Test: gd/cert/run SecurityTest
Fix: 231745328
Bug: 241962982
Bug: 242184809
Ignore-AOSP-First: Cherry-picked from AOSP
Merged-In: Iefb3592b5869459adfd0196f9b3c20a2c4cf3745
Change-Id: Iefb3592b5869459adfd0196f9b3c20a2c4cf3745
parent ba7adb3f
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -764,14 +764,19 @@ void LinkLayerController::IncomingDisconnectPacket(
             peer.ToString().c_str());
    return;
  }
#ifdef ROOTCANAL_LMP
  auto is_br_edr = connections_.GetPhyType(handle) == Phy::Type::BR_EDR;
#endif
  ASSERT_LOG(connections_.Disconnect(handle),
             "GetHandle() returned invalid handle %hx", handle);

  uint8_t reason = disconnect.GetReason();
  SendDisconnectionCompleteEvent(handle, reason);
#ifdef ROOTCANAL_LMP
  if (is_br_edr) {
    ASSERT(link_manager_remove_link(
        lm_.get(), reinterpret_cast<uint8_t(*)[6]>(peer.data())));
  }
#endif
}

@@ -2937,8 +2942,9 @@ ErrorCode LinkLayerController::Disconnect(uint16_t handle, uint8_t reason) {
  }

  const AddressWithType remote = connections_.GetAddress(handle);
  auto is_br_edr = connections_.GetPhyType(handle) == Phy::Type::BR_EDR;

  if (connections_.GetPhyType(handle) == Phy::Type::BR_EDR) {
  if (is_br_edr) {
    LOG_INFO("Disconnecting ACL connection with %s", remote.ToString().c_str());

    uint16_t sco_handle = connections_.GetScoHandle(remote.GetAddress());
@@ -2964,8 +2970,11 @@ ErrorCode LinkLayerController::Disconnect(uint16_t handle, uint8_t reason) {
  connections_.Disconnect(handle);
  SendDisconnectionCompleteEvent(handle, reason);
#ifdef ROOTCANAL_LMP
  if (is_br_edr) {
    ASSERT(link_manager_remove_link(
      lm_.get(), reinterpret_cast<uint8_t(*)[6]>(remote.GetAddress().data())));
        lm_.get(),
        reinterpret_cast<uint8_t(*)[6]>(remote.GetAddress().data())));
  }
#endif
  return ErrorCode::SUCCESS;
}