Repository navigation
feat(protocols): add the IP_Pseudo pseudo-protocol for the IP pseudo-header (#2471) - #2479
Conversation
|
NEEDS CHANGES (Sonnet,
|
|
Verified ( |
|
NEEDS CHANGES (Sonnet,
|
|
Coverage: 94.52% (unit tier, Python 3.15,
Per-file detail: the |
|
NEEDS CHANGES (Sonnet,
|
a6f8103 to
3ccb925
Compare
|
NEEDS CHANGES (Sonnet,
|
Rebase NoteOld head: Changes from merge with
|
|
Cross-review (Sonnet) at
Detection heuristic itself confirmed sound otherwise (no false positives across 5 probed scenarios). Fixing both now. |
Two defects found in cross-review: - isort flagged the import block (make isort / test_isort_clean.py). - _upper's malformed-extension-header detection sat inside try: ... except ValueError: pass, but ProtocolError subclasses ValueError, so the specific raise was dead code -- any path that hit it fell through silently to the generic error. Narrowed the except to wrap only the Enum_ExtensionHeader(code) lookup, moving the raises outside it. Verified: tests/protocols/misc/checksum/, test_isort_clean.py and test_fields_misc.py pass clean (53 tests, 115 subtests). A deeper, separate issue surfaced while testing this: when a malformed extension header follows a VALID one rather than being the IPv6 layer's direct next header, IPv6 itself drops it as NoPayload (not Raw), so IP_Pseudo has no signal to detect that case at all. Left out of scope here -- it is a gap in IPv6's own extension-header handling, not something this fix's detection logic can work around.
|
Pushed One thing deliberately left out: while testing the except-clause fix, I found a genuinely separate, deeper gap -- a malformed extension header that follows a VALID one (rather than being IPv6's direct next header) gets dropped by IPv6 itself as |
|
Cross-review (Sonnet) at |
…eader # Conflicts: # pcapkit/protocols/data/__init__.py # pcapkit/protocols/schema/__init__.py Co-authored-by: JarryShaw <15666417+JarryShaw@users.noreply.github.com>
make pylint,make mypy,make isort) on the touched modulesmake testpasses, and a test case covers the change. The full suite was not run; see Testing.What is the purpose of your pull request?
feat— adds a featureDescription of your pull request and other information
Closes #2471.
IP_Pseudobuilds the IPv4 (RFC 793) or IPv6 (RFC 8200 §8.1) pseudo-header from anIPv4/IPv6layer, explicit values, or both.ProtocolError: a non-zero offset or More Fragments, a truncated or malformed header. An atomic fragment is a whole packet.src,dst,protocol,upper_length,zerooverride those read fromip, and an explicitprotocolskips the UDP Length read; out-of-range lengths raiseFieldValueError.Testing:
test_ip_pseudo_2471_unit.py(captured frames, walk cases, mutants),test_fields_misc.py(switch table),test_rfc_constants_one_home_1739_unit.py;ip_pseudo.pyat 100% line and branch.