-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
added support for more DHCPv6 options #1945
Conversation
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.
Looking good. It’s a great practice to update older custom fields and use PacketListField
& co instead. Thanks for that !
scapy/layers/dhcp6.py
Outdated
@@ -413,8 +414,8 @@ class DHCP6OptIA_TA(_DHCP6OptGuessPayload): # RFC sect 22.5 | |||
FieldLenField("optlen", None, length_of="iataopts", | |||
fmt="!H", adjust=lambda pkt, x: x + 4), | |||
XIntField("iaid", None), | |||
_IATAOptField("iataopts", [], DHCP6OptIAAddress, | |||
length_from=lambda pkt: pkt.optlen - 4)] | |||
PacketListField("iataopts", [], guess_payload_class_and_make_instance, |
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.
Instead of this, you could set _DHCP6OptGuessPayload
and add a dispatch_hook
handler to the latter. That would be super clean.
See p-l-‘s post on: https://stackoverflow.com/a/28025620/5459467 for more infos (we should add this in the doc..)
Flake8 report:
Tabs/spaces inconsistency are critical in Python 3+. Sorry for the annoyance, we enforce the PEP8 rules to all new code Codespell report:
Please add the |
Codecov Report
@@ Coverage Diff @@
## master #1945 +/- ##
=========================================
- Coverage 85.86% 81.3% -4.56%
=========================================
Files 187 129 -58
Lines 42775 30505 -12270
=========================================
- Hits 36729 24803 -11926
+ Misses 6046 5702 -344
|
Codecov Report
@@ Coverage Diff @@
## master #1945 +/- ##
==========================================
+ Coverage 85.86% 85.89% +0.03%
==========================================
Files 187 187
Lines 42775 42848 +73
==========================================
+ Hits 36729 36806 +77
+ Misses 6046 6042 -4
|
test/regression.uts
Outdated
@@ -1825,7 +1825,7 @@ class ATMT5(Automaton): | |||
@ATMT.condition(BEGIN, prio=-1) | |||
def tr3(self): | |||
self.res += "u" | |||
|
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.
The spacing changes in the automaton classes break them. You could probably delete those spacing lines.
Thanks for the update ! A last comment and that will be it |
test/regression.uts
Outdated
@@ -1437,11 +1437,11 @@ def _test(): | |||
conf.debug_dissector = False | |||
ans,unans=sr(IP(dst="www.google.com/30")/TCP(dport=[80,443]),timeout=2) | |||
conf.debug_dissector = old_debug_dissector | |||
|
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.
This one is failing to. It should be the last one
@godfryd it looks good to me, however before this PR can be merged could you revert the unnecessary change to |
@guedou Do we really care about the unit tests history ? |
Yes =)
|
Do you mean I should bring back trailing whitespaces in regression.uts or something else? |
Thanks !
|
What next? |
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.
This PR improves several options in DHCPv6 and adds some new.
Added options:
Improved DHCP6OptIA_NA, DHCP6OptIA_TA, DHCP6OptIA_PD to convey correctly different types of options (not only DHCP6OptIAPrefix as it was before).
Fixed parsing and detecting suboptions using guess_payload_class_and_make_instance.
Previously there was inserted in-between empty Generic Message.