Skip to content

fix(hip): make() without parameters writes Header Length 0, below the RFC 7401 minimum of 4 #1189

Closed

Description

@JarryShaw

Describe the bug
HIP.make(parameters=None) writes Header Length 0 (parameters_value, length = [], 0). RFC 7401 §5.1 says the minimum is 4: the field counts 8-octet units excluding the first 8, and every header carries both 16-octet HITs. Construction then fails in its own re-parse. read computes _prml = (0 - 4) * 8 = -32, which is truthy, so it calls _read_hip_param(-32) and raises ProtocolError: HIPv2: invalid format (hip.py:792).

To Reproduce
On origin/main, run HIP(parameters=None, version=2, next=59, packet=1, checksum=b'\x00\x00', controls_anonymous=False, shit=0, rhit=0, payload=b''). It packs 3b00012100000000… with a length byte of 0 and raises as described. HIPv1 behaves the same way.

Expected behavior
A parameterless header is 40 octets with Header Length 4, and it parses back.

Found by the #1188 worker. The #1188 cross-review reproduced it and checked RFC 7401 §5.1.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  2. moved this to Pending in PyPCAPKiton Oct 7, 2026
  3. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1188 merges, because both edit pcapkit/protocols/internet/hip.py.

  4. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  5. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1188 merged. A worker is on it now.

  6. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 7, 2026
  7. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 7, 2026
  8. added this to the PyPCAPKit v1.5 milestone on Oct 25, 2026
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

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions