From 7e1b1c8f78e681a3b18f7ff968cc9e625c7853e0 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Thu, 22 Jan 2026 23:16:25 +0800 Subject: [PATCH] L2CAP: Fix wrong CID on reject --- bumble/l2cap.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bumble/l2cap.py b/bumble/l2cap.py index f01276e9..c5e617f2 100644 --- a/bumble/l2cap.py +++ b/bumble/l2cap.py @@ -2342,8 +2342,8 @@ def on_l2cap_connection_request( cid, L2CAP_Connection_Response( identifier=request.identifier, - destination_cid=request.source_cid, - source_cid=0, + destination_cid=0, + source_cid=request.source_cid, result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_NO_RESOURCES_AVAILABLE, status=0x0000, ), @@ -2355,7 +2355,12 @@ def on_l2cap_connection_request( f'creating server channel with cid={source_cid} for psm {request.psm}' ) 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 @@ -2372,8 +2377,8 @@ def on_l2cap_connection_request( cid, L2CAP_Connection_Response( identifier=request.identifier, - destination_cid=request.source_cid, - source_cid=0, + destination_cid=0, + source_cid=request.source_cid, result=L2CAP_Connection_Response.Result.CONNECTION_REFUSED_PSM_NOT_SUPPORTED, status=0x0000, ),