You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hip): make() without parameters writes Header Length 0, below the RFC 7401 minimum of 4 #1189
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
JarryShaw commentedon Oct 7, 2026
Blocked until #1188 merges, because both edit
pcapkit/protocols/internet/hip.py.JarryShaw commentedon Oct 7, 2026
Unblocked: #1188 merged. A worker is on it now.