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
Conform to RFC 3396 & RFC 2131 wrt Options #228
Conversation
This looks good to me, thanks for the cleanup and improvements.
|
Also approving but not merging yet to give @insomniacslk a chance to look at it. |
Removes AddOption and GetOption. RFC 2131 specifies that options may only appear once (Section 4.1). If an option does appear more than once, its byte values must be concatenated. RFC 3396 further specifies that to send options longer than 255 bytes, one option may be split into multiple option codes, which must be concatenated back together by the receiver. Both of these are concerned with the byte representation of options. Fact is, based on both RFCs one can say that an option may only appear once, but may be composed of multiple values. Because an option may appear only once logically in any case, we remove the AddOption and GetOption functions and leave only UpdateOption and GetOneOption. Also remove all additions & checks of the End option - the marshaling and unmarshaling code is exclusively responsible for that now.
Codecov Report
@@ Coverage Diff @@
## master #228 +/- ##
==========================================
- Coverage 72.39% 71.91% -0.49%
==========================================
Files 83 83
Lines 3688 3642 -46
==========================================
- Hits 2670 2619 -51
- Misses 902 905 +3
- Partials 116 118 +2
Continue to review full report at Codecov.
|
rebased :) |
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.
Looks good to me, thanks @hugelgupf !
Just one question - what about the Pad option? Per concept of padding I would expect that Pad could be added more than once, but this clashes with what described in the RFC.
I think padding should be done by the marshaling routines where necessary. (To pad the packet to its minimum length or to pad the Overload fields.) One more thing for the user not to worry about. |
Sounds good. This also confirms that after these changes this becomes a production-only library and not allowing anymore scapy-like packet crafting (which is OK, just acknowledging here for the future choices) |
Most things can still be crafted but you are right, we won't control the padding. For me it is OK too. |
Removes AddOption and GetOption.
RFC 2131 specifies that options may only appear once (Section 4.1). If
an option does appear more than once, its byte values must be
concatenated.
RFC 3396 further specifies that to send options longer than 255 bytes,
one option may be split into multiple option codes, which must be
concatenated back together by the receiver.
Both of these are concerned with the byte representation of options.
Fact is, based on both RFCs one can say that an option may only appear
once, but may be composed of multiple values. (Like the multiple IP options.)
Because an option may appear only once logically in any case, we remove
the AddOption and GetOption functions and leave only UpdateOption and
GetOneOption.
Also remove all additions & checks of the End option - the marshaling
and unmarshaling code is exclusively responsible for that now.
(will rebase after #226 is merged.)
The full RFC 3396 is not supported at the moment, as the Overload option is not respected. (Who TF even uses that.)