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

Commit 7022c09c authored by Ted Wang's avatar Ted Wang Committed by Hansong Zhang
Browse files

L2CAP: Fix configuration_request timeout

On configuration_request timeout, we need to send a disconnect request
with correct scid and dcid. Also fixed the cert test for this

Bug: 145720848
Test: run_cert.sh test_disconnect_on_timeout [L2CAP/COS/CED/BV-08-C]
Change-Id: I408eb14914b14ca2b7d6de68ff0480daf2dcb3c8
parent 048e0ec1
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -287,10 +287,14 @@ class SimpleL2capTest(GdBaseTestClass):
        self._setup_link()
        scid = 0x0101
        psm = 1
        self._open_channel(scid=0x0101, psm=0x1)

        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(psm=psm))

        # Don't send configuration request
        def handle_connection_response(log):
            log = log.connection_response
            self.scid_dcid_map[log.scid] = log.dcid
        self.event_handler.on(is_connection_response, handle_connection_response)
        # Don't send configuration response back
        self.event_handler.on(is_configuration_request, lambda _: True)
        self.cert_device.l2cap.SendConnectionRequest(l2cap_cert_pb2.ConnectionRequest(scid=scid, psm=psm))
@@ -301,9 +305,17 @@ class SimpleL2capTest(GdBaseTestClass):
            # DUT should not send configuration response due to timeout
            assert False
        self.event_handler.on(is_configuration_response, handle_configuration_response)
        disconnect_request_received = []
        def handle_disconnection_request(log):
            log = log.disconnection_request
            disconnect_request_received.append((log.scid, log.dcid))
        self.event_handler.on(is_disconnection_request, handle_disconnection_request)
        logs = self.cert_device.l2cap.FetchL2capLog(l2cap_cert_pb2.FetchL2capLogRequest())
        self.event_handler.execute(logs)

        # Note: DUT may not support sending disconnect request so this should be optional
        assert (self.scid_dcid_map[scid], scid) in disconnect_request_received

    def test_basic_operation_request_connection(self):
        """
        L2CAP/COS/CED/BV-01-C [Request Connection]
+2 −1
Original line number Diff line number Diff line
@@ -650,7 +650,8 @@ void ClassicSignallingManager::on_command_timeout() {
      break;
    }
    case CommandCode::CONFIGURATION_REQUEST: {
      SendDisconnectionRequest(command_just_sent_.source_cid_, command_just_sent_.destination_cid_);
      auto channel = channel_allocator_->FindChannelByRemoteCid(command_just_sent_.destination_cid_);
      SendDisconnectionRequest(channel->GetCid(), channel->GetRemoteCid());
      break;
    }
    default: