Fix BLE Link-Layer byte order - #5072
Conversation
|
Thanks for the PR. Please revert all formatting only changes to reduce our review effort. |
|
My bad. Done! |
|
Please fix ''' |
There was a problem hiding this comment.
Pull request overview
This pull request aligns Scapy’s Bluetooth LE Link Layer packet serialization with the Bluetooth Core spec requirement that multi-octet Link Layer fields are transmitted least-significant octet first (little-endian), correcting the on-the-wire byte order for several LL PDUs.
Changes:
- Switched BTLE/LL packet fields in
BTLE_CONNECT_REQ,LL_CONNECTION_PARAM_REQ/RSP,LL_PHY_UPDATE_IND, andLL_CIS_*to little-endian field types (XLE*). - Added/updated unit tests to assert the exact raw byte layouts for
BTLE_CONNECT_REQ,LL_CONNECTION_PARAM_REQ/RSP, andLL_PHY_UPDATE_IND.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/scapy/layers/bluetooth4LE.uts | Adds raw byte-order assertions for several updated LL PDUs to prevent regressions. |
| scapy/layers/bluetooth4LE.py | Corrects field endianness for multiple Link Layer PDUs by using little-endian field classes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| XLEShortField("max_pdu_p_to_c", 0), | ||
| XByteField("nse", 0), | ||
| X3BytesField("subinterval", 0x0), | ||
| XLE3BytesField("subinterval", 0x0), |
The Bluetooth standard requires multi-octet Link Layer fields to transmit the least-significant octet first Vol 6, Part B, §1.2 Hence, BTLE_CONNECT_REQ, LL_CONNECTION_PARAM_REQ, LL_CONNECTION_PARAM_RSP, LL_PHY_UPDATE_IND, LL_CIS_REQ, LL_CIS_RSP, and LL_CIS_IND were changed accordingly. AI-Assisted: no
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5072 +/- ##
==========================================
- Coverage 80.50% 80.50% -0.01%
==========================================
Files 390 390
Lines 96785 96785
==========================================
- Hits 77920 77912 -8
- Misses 18865 18873 +8
🚀 New features to boost your workflow:
|
The Bluetooth standard requires multi-octet Link Layer fields to transmit the least-significant octet first Vol 6, Part B, §1.2
Hence, BTLE_CONNECT_REQ, LL_CONNECTION_PARAM_REQ, LL_CONNECTION_PARAM_RSP, LL_PHY_UPDATE_IND, LL_CIS_REQ, LL_CIS_RSP, and LL_CIS_IND were changed accordingly.
AI-Assisted: no