Repository navigation
fix(ipv6-opts): SMF_DPD H-DPD with an empty hav raises IndexError instead of ProtocolError - #1194
Merged
Merged
Conversation
…tead of ProtocolError _make_opt_smf_dpd set the H-DPD mode bit with hav[0] | 0x80 and no length check. HOPOPT and IPv6_Opts now reject an empty Hash Assist Value with a ProtocolError naming the option, like the other SMF_DPD validation errors. Closes #1193
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.90% (unit tier, Python 3.14,
Per-file detail: the |
This was referenced Oct 7, 2026
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.
Searched for similar pull requests
Followed the coding style (pylint/mypy/isort on the changed files: nothing new on the touched lines, mypy clean, isort clean)
make testpasses, and a test case covers the change (modules listed below)Added a changelog entry — N/A, added centrally
fix— corrects a defectCloses #1193.
_make_opt_smf_dpd(HOPOPT and IPv6-Opts) now rejects an empty H-DPDhavbefore it sets the mode bit withhav[0] | 0x80.HOPOPT(next=59, options=[(Option.SMF_DPD, {'mode': SMFDPDMode.H_DPD, 'hav': b''})])raisesIndexError: index out of range.IPv6_Optsdoes the same.ProtocolError: HOPOPT: [OptNo 8] empty Hash Assist Value (HAV)(IPv6-Opts: ...for the other class)._read_opt_smf_dpdnever indexeshav. A wire H-DPD option withlen=0parses tohav=b''without raising, so it is not this defect class and is left unchanged.tests/protocols/internet/test_smf_dpd_empty_hav_unit.py: without the fix, 2 failed withIndexError. With the fix,2 passed, 4 subtests passed.test_smf_dpd_mode_rebuild_unit4 passed;test_option_roundtrip_unit6 passed;test_ipv6_extension_runtime3 passed;tests/project389 passed, 1 skipped;util/run_unittest_leg.py protocols/internet493 tests, 0 failures.