Repository navigation
Conversation
…v#4947) (1/2) modified: scapy/layers/dot15d4.py Frame version 0b10 (2) redefines two formerly reserved Frame Control bits and changes which MHR fields are present. The layer was only correct for 2003/2006 frames, so 2015+ captures (ex. Wi-SUN, TSCH, Thread 1.4) were mis-dissected (addresses and PAN IDs were read at the wrong offsets). Added fcf_ie_present (bit 9) and fcf_seqnumsuppress (bit 8) in place of fcf_reserved_2; the sequence number is now conditional. Name frame versions and the Multipurpose/Fragment/Extended frame types. destination/source PAN ID and address presence now follows 7.2.2.6 Table 7-2 for version 2 (PAN ID Compression now also governs the destination PAN ID); versions 0b00/0b01 (0/1) are unchanged. Added Header IE (7.4.2) and Payload IE (7.4.3) dissection, including Header Termination 1/2 and Payload Termination handling, after the Aux Security Header; payload IEs are not parsed when encrypted. Dot15d4Ack now carries addressing/security/IEs for 0b10; Imm-Ack behaviour is unchanged. no Superframe/GTS/Pending Address fields for 0b10. Added Frame Counter Suppression and ASN in Nonce bits; frame counter becomes conditional. Extend the MAC command ID enum to the 2024 table patch: Added IEEE 802.15.4-2015+ frame tests (secdev#4947) (2/2) modified: test/scapy/layers/dot15d4.uts Added tests covering captures from round-trip, PAN ID presence, Sequence Number Suppression, Enh-Ack, Enhanced Beacon and Frame Counter Suppression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added support for IEEE 802.15.4-2015+ to
scapy/layers/dot15d4.py.Until now only 2003/2006 frames where supported
Frame version
0b10(802.15.4-2015 and later) defines Frame Control bits that used to be reserved, thus changing the rules for which MHR fields are present. Scapy kept applying the old rules to these frames, so captures from Wi-SUN, TSCH and Thread 1.4 were dissected wrongly.Changes
fcf_seqnumsuppressandfcf_ie_present, in the bits that were reserved before0b00and0b01behave exactly as before.fcf_ie_presentis set./!\ header fields are present depending on frame version + PAN ID Compression + addressing modes taken together.
I kept the old code path untouched for versions 0/1 and added a separate one for version 2. This avoids regressions on existing captures, at the cost of a little duplication.
Impact
Nothing should change for 2003/2006 frames: all existing dot15d4 tests passed unchanged. Layers built on top of 802.15.4 (6LoWPAN, ZigBee) still receive the same payload.
Tests
Second commit added unit tests to
test/scapy/layers/dot15d4.uts:Results were not checked against real Wi-SUN or TSCH as we don't have enough samples.
fixes #4947