python / cpython

The Python programming language
https://www.python.org
Other
62.27k stars 29.92k forks source link

sockaddr_l2 lacks CID, address type (AF_BLUETOOTH sockets) #70145

Open 2a5e0583-3be1-41f6-8ecb-fcbd9cece0f6 opened 8 years ago

2a5e0583-3be1-41f6-8ecb-fcbd9cece0f6 commented 8 years ago
BPO 25957
Nosy @vstinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['extension-modules', 'type-bug', 'library'] title = 'sockaddr_l2 lacks CID, address type (AF_BLUETOOTH sockets)' updated_at = user = 'https://bugs.python.org/mikeryan' ``` bugs.python.org fields: ```python activity = actor = 'steve.dower' assignee = 'none' closed = False closed_date = None closer = None components = ['Extension Modules', 'Library (Lib)'] creation = creator = 'mikeryan' dependencies = [] files = [] hgrepos = [] issue_num = 25957 keywords = [] message_count = 2.0 messages = ['257043', '257120'] nosy_count = 2.0 nosy_names = ['vstinner', 'mikeryan'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue25957' versions = ['Python 2.7'] ```

2a5e0583-3be1-41f6-8ecb-fcbd9cece0f6 commented 8 years ago

The AF_BLUETOOTH socket type lacks support for specifying CID and address type in sockaddr_l2. These structure members have been present since 2009 and 2012 respectively:

https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=3de95535 https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=ba801fcd

The current version of the full structure can be found here:

https://git.kernel.org/cgit/bluetooth/bluez.git/tree/lib/l2cap.h?id=1b9e48f4#n40

The Python code in question can be found here:

https://github.com/python/cpython/blob/4f9794dbcaa6ee7ddc6ab175a57e7f01ebe64353/Modules/socketmodule.c#L1108

2a5e0583-3be1-41f6-8ecb-fcbd9cece0f6 commented 8 years ago

AF_BLUETOOTH also lacks support for hci_channel in sockaddr_hci for BTPROTO_HCI sockets:

https://git.kernel.org/cgit/bluetooth/bluez.git/tree/lib/hci.h?h=5.37#n2340

This feature has been present in BlueZ since 2010:

https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=12d02e7f

(Note that the latest BlueZ release includes a total of five different channels that should be supported)