L2CAP: Fix wrong CID on reject

This commit is contained in:
Josh Wu
2026-01-22 23:16:25 +08:00
parent 4986f55043
commit 7e1b1c8f78

View File

@@ -2342,8 +2342,8 @@ class ChannelManager:
cid, cid,
L2CAP_Connection_Response( L2CAP_Connection_Response(
identifier=request.identifier, identifier=request.identifier,
destination_cid=request.source_cid, destination_cid=0,
source_cid=0, source_cid=request.source_cid,
result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_NO_RESOURCES_AVAILABLE, result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_NO_RESOURCES_AVAILABLE,
status=0x0000, status=0x0000,
), ),
@@ -2355,7 +2355,12 @@ class ChannelManager:
f'creating server channel with cid={source_cid} for psm {request.psm}' f'creating server channel with cid={source_cid} for psm {request.psm}'
) )
channel = ClassicChannel( channel = ClassicChannel(
self, connection, cid, request.psm, source_cid, server.spec manager=self,
connection=connection,
signaling_cid=cid,
psm=request.psm,
source_cid=source_cid,
spec=server.spec,
) )
connection_channels[source_cid] = channel connection_channels[source_cid] = channel
@@ -2372,8 +2377,8 @@ class ChannelManager:
cid, cid,
L2CAP_Connection_Response( L2CAP_Connection_Response(
identifier=request.identifier, identifier=request.identifier,
destination_cid=request.source_cid, destination_cid=0,
source_cid=0, source_cid=request.source_cid,
result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_PSM_NOT_SUPPORTED, result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_PSM_NOT_SUPPORTED,
status=0x0000, status=0x0000,
), ),