-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add LoWPAN enhancements #3556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add LoWPAN enhancements #3556
Conversation
akestoridis
commented
Mar 26, 2022
- Create an mle layer
- Improve the dissection of secured MAC Data packets
- Improve the dissection of secured MAC Beacon packets
- Enable the dissection of Thread beacons
- Improve the dissection of secured MAC Command packets
- Improve the dissection of 6LoWPAN Mesh header fields
- Fix bug in the extraction of the source address of 6LoWPAN packets
- Improve the dissection of 6LoWPAN IPHC header fields
- Fix bug in the 6LoWPAN dispatcher
- Add unit tests
f2b3f5a
to
1c6421c
Compare
Codecov Report
@@ Coverage Diff @@
## master #3556 +/- ##
==========================================
- Coverage 86.18% 86.17% -0.02%
==========================================
Files 284 285 +1
Lines 64874 65024 +150
==========================================
+ Hits 55914 56032 +118
- Misses 8960 8992 +32
|
14b4038
to
90a8932
Compare
90a8932
to
123db03
Compare
Fixed compatibility with Python 2.7, added more unit tests, squashed them into one commit, and rebased against master. |
if len(payload) > 0: | ||
if ( | ||
(isinstance(payload[0], int) and payload[0] == 0x03) or | ||
(isinstance(payload[0], bytes) and payload[0] == b'\x03') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use orb(payload[0]) == 0x03
to work on all Python versions (from scapy.compat import orb
)
return ThreadBeacon | ||
elif ( | ||
(isinstance(payload[0], int) and payload[0] == 0x00) or | ||
(isinstance(payload[0], bytes) and payload[0] == b'\x00') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
elif self.aux_sec_header.sec_sc_seclevel in {3, 7}: | ||
mic_length = 16 | ||
else: | ||
mic_length = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a lot of code that is re-used. Could you exerternalize it to a function?
self.aux_sec_header.remove_payload() | ||
if mic_length > 0 and mic_length <= len(self.sec_payload): | ||
self.mic = self.sec_payload[-mic_length:] | ||
self.sec_payload = self.sec_payload[:-mic_length] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same: you could reuse the function defined above.
Thanks for the PR, I have a few comments to start with. Very sorry for the review delay |
Thank you for reviewing the PR. Unfortunately, I am unable to make further changes. However, you are welcome to refactor the code in a follow-up commit. The unit tests of this PR should pass even after the suggested changes. |