Skip to content

Two dropped-keyword/wrong-cast defects flagged in review and never filed (hip.py:3533, ipv6_route.py:207) #556

Description

@JarryShaw

Two small defects found by a sweep of deferred work across this release's 68 merged PRs, both flagged in review and never filed.

1. HIP._make_param_encrypted passes a keyword the schema does not have

pcapkit/protocols/internet/hip.py:3533 passes cipher= where the schema field is __cipher__. The value is silently dropped, so a HIP ENCRYPTED parameter built through make loses its IV. Flagged in #430's review, re-flagged in #434 as "carried across unchanged".

Same root shape as the ts_data keyword in #552: the schema warns UnknownFieldWarning rather than erroring, so the mistake is invisible at runtime.

2. RPL.post_process casts a list as though it were bytes

pcapkit/protocols/schema/internet/ipv6_route.py:207 casts self.addresses to bytes while it is still list[bytes], which raises at pack time. Reproduced during #489's review and left with only a code comment rather than a fix.

An un-called field's template and length disagree — reported, but narrower than first described

Worth recording accurately because the original report overstated it. The claim was that NumberField.__call__ discards __template__ and causes a silent wrong-width parse. Measured, that is not what happens:

Int32Field()           after __call__: _template='>i' _length=4
Int32Field(length=2)   after __call__: _template='>h' _length=2
Int32Field(length=2).unpack(b'\x00\x01', {}) -> 1      # correct for 2 octets

After __call__ the template and length agree and the parse is right. The inconsistency exists only in the un-called state: Int32Field(length=2) constructs with _template='>i' (4 octets) against _length=2, so FieldBase.length reports 4 until the field is called. Since schema fields are always called during pack and unpack, this appears latent rather than live — but it is a real internal inconsistency and it is what made #549's "inverse trap" note read worse than the behaviour warrants.

No fix proposed here; recording it so the next person who reads #549's note does not chase a wrong-parse bug that does not exist.

Coverage

For 1, a test that builds a HIP ENCRYPTED parameter through make and asserts the IV survives. For 2, a test that packs an RPL routing header with a multi-address list. Both proven to fail without their fix, exit codes read from a file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions