Skip to content

Conversation

@zxzxwu
Copy link
Collaborator

@zxzxwu zxzxwu commented Jan 22, 2026

It looks like a typo because on success it takes

    def on_connection_request(self, request: L2CAP_Connection_Request) -> None:
        self.destination_cid = request.source_cid
        self._change_state(self.State.WAIT_CONNECT)
        self.send_control_frame(
            L2CAP_Connection_Response(
                identifier=request.identifier,
                destination_cid=self.source_cid,
                source_cid=self.destination_cid,
                result=L2CAP_Connection_Response.Result.CONNECTION_SUCCESSFUL,
                status=0x0000,
            )
        )


    def on_l2cap_connection_request(
        self, connection: Connection, cid: int, request: L2CAP_Connection_Request
    ) -> None:
            ...
            source_cid = self.find_free_br_edr_cid(connection_channels)
            ...
            channel = ClassicChannel(
                manager=self,
                connection=connection,
                signaling_cid=cid,
                psm=request.psm,
                source_cid=source_cid,
                spec=server.spec,
            )
image

@zxzxwu zxzxwu requested a review from barbibulle January 22, 2026 15:20
@barbibulle
Copy link
Collaborator

You're right, this was reversed. In practice, it shouldn't have cause problems, because the spec says that for an unsuccessful result, those fields shall be ignored:
" If the result field does not indicate the connection was
successful, the DCID and SCID fields may be invalid and shall be ignored."

But it's good to fix it anyway.

@zxzxwu
Copy link
Collaborator Author

zxzxwu commented Jan 23, 2026

This could help initiator to identify which L2CAP_CONNECTION_REQ is rejected, yet it's likely an ambiguous case, since L2CAP TS doesn't provide any TC about rejected response.

@zxzxwu zxzxwu merged commit 3f9ef5a into google:main Jan 23, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants