Repository navigation
fix(protocols): Quick-Start option readers use schema.func, which exists only under TYPE_CHECKING - #1117
Merged
Conversation
…sts only under TYPE_CHECKING - _read_opt_qs in IPv4, HOPOPT and IPv6-Opts now reads the function from flags['func'], as it already reads rate. schema.func is set only by _QSOption.post_process, so a schema built by _make_opt_qs raised AttributeError when re-read. - quick_start_data_selector in schema/internet/hopopt.py and ipv6_opts.py sized the nested suboption as 5 octets against the 8-octet option, which mis-decoded the nonce; it now uses 8. - Drop the three Quick-Start EXPECTED_FAILURES entries; two reader tests that injected schema.func now set flags['func'] instead. Closes #1091
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.74% (unit tier, Python 3.14,
Per-file detail: the |
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.
make pylint,make mypy,make isort) — run on the 5 touchedpcapkit/files with the Makefile flags; no findings on changed lines (2 mypyunused-ignoreathopopt.py:1634/ipv6_opts.py:1623predate this PR)make testpasses, and a test case covers the change — the modules listed below, not the full suitedocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrally after the waveWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1091.
_read_opt_qs(IPv4, HOPOPT, IPv6-Opts) now readsflags['func'], matching how it already readsflags['rate'];schema.funcis set only by_QSOption.post_process, so maker-built schemas raisedAttributeError. HOPOPT/IPv6-Optsquick_start_data_selectoralso usedSchemaField(length=5)for an 8-octet option (the second defect theEXPECTED_FAILURESentries recorded), now 8.Probe (
make_samples.py): before, 8 left out incl.hopopt-option/Quick_Start,ipv4-option/QS,ipv6-opts-option/Quick_Start(no attribute 'func'). After, 5 left out, none Quick-Start; 256 → 259 capturable. A built HOPOPT/IPv6-Opts option with nonce19088743decoded as16777216withpacket length < 0: -3; now19088743, no warning.New
tests/protocols/internet/test_quick_start_func_unit.py(round trip ×3 families ×2 functions, plus HOPOPT/IPv6-Opts wire nonce). Reverting the reader fix: 6 subtests fail (AttributeError); reverting the length fix: 6 fail (SchemaWarning: packet length < 0: -3). With both:2 passed, 8 subtests passed. Removed the three Quick-StartEXPECTED_FAILURESentries;test_ipv4_unitandtest_ipv6_extension_unitinjectedschema.functo reach the unknown-function branch, now setflags['func'].Passing:
test_option_roundtrip_unit(6),test_ipv4_unit(26),test_ipv6_extension_unit(61),test_ipv6_ext_unit(30),test_ipv6_extension_runtime(3),test_option_coverage_runtime(3),test_tcp_udp_unit(18),tests/project(379 passed, 1 skipped).