You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As has been discussed previously (69242, 70145), "new" fields have been added in sockaddr_l2, but are still not supported in CPython's socket implementation.
The lack of l2_bdaddr_type prevents opening L2CAP connection-oriented channels to Bluetooth LE devices.
Likewise, the missing l2_cid prevents raw access to e.g ATT.
My suggestion is to add support for a third and fourth optional element in the address tuple for l2_cid and l2_bdaddr_type respectively.
Only one of psm and cid can be non-zero. This is enforced by the kernel.
l2_bdaddr_type can take the value of BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM. BDADDR_BREDR is implied if the element is missing, preserving compatibility with existing code.
…ress tuple
To be able to connect L2CAP sockets to Bluetooth LE devices, the l2_bdaddr_type must be set to BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM.
This change adds support for providing the l2_bdaddr_type as an optional, traliing element in the address tuple passed to connect()
Feature or enhancement
Proposal:
As has been discussed previously (69242, 70145), "new" fields have been added in
sockaddr_l2
, but are still not supported in CPython'ssocket
implementation.l2_bdaddr_type
prevents opening L2CAP connection-oriented channels to Bluetooth LE devices.l2_cid
prevents raw access to e.g ATT.My suggestion is to add support for a third and fourth optional element in the address tuple for
l2_cid
andl2_bdaddr_type
respectively.psm
andcid
can be non-zero. This is enforced by the kernel.l2_bdaddr_type
can take the value ofBDADDR_LE_PUBLIC
orBDADDR_LE_RANDOM
.BDADDR_BREDR
is implied if the element is missing, preserving compatibility with existing code.I.e for LE CoC connection to PSM
0x80
For a raw LE ATT connection:
while keeping the existing format for classic BR/EDR L2CAP.
I have a working implementation of this locally (tested on Linux 6.11) and will file a PR for review as soon as I've got this issue number assigned.
This is my first attempt at contributing to CPython, so I apologize in advance for any mistakes in the process.
Edit 2025-01-26: Added CID field to proposal. PR to be updated.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
#69242
#70145
Linked PRs
The text was updated successfully, but these errors were encountered: