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(ipv6-ext): the IPv6_Ext fallback length hint is 2, below the RFC 8200 minimum #1178
Decision needed: should IPv6_Ext.__length_hint__ stay at 2?
pcapkit/protocols/internet/ipv6_ext.py:578-586 returns 2, set in 93cf940 (#917/#924) as the part of the header that RFC 6564 §4 guarantees. Since #1171 merged, the hint also decides when a short stream becomes Raw. That threshold is reasonable for an unknown header, but RFC 8200 §4 makes every extension header at least 8 octets long.
Measured on origin/main and on #1176 alike: an unknown extension header, or a HOPOPT stream of 4–7 octets, falls back to IPv6_Ext and rebuilds as 40 octets, using bytes that were never on the wire. #1176 raised the hints of the concrete classes and deliberately left this one alone.
Keep 2. The fallback class trusts only what RFC 6564 guarantees.
Raise to 8, the RFC 8200 minimum, so a 2–7 octet tail becomes Raw. This changes the pin test_length_hint_is_the_two_octets_rfc_6564_guarantees.
My recommendation is option 2, raise the hint to 8. It turns out the two RFCs don't conflict: RFC 6564 sets the same minimum.
RFC 6564 §4, Figure 1, defines Hdr Ext Len as the "length of the extension header in 8-octet units, not including the first 8 octets". By its own definition, a conforming header is therefore never shorter than 8 octets.
The "2 octets" in the current docstring is the part of the layout RFC 6564 fixes: Next Header and Hdr Ext Len at offsets 0 and 1. That is how many octets you need to read the length. It is not the minimum length of a header.
RFC 8200 §4 says the same thing ("an integer multiple of 8 octets long"). Both RFCs give 8.
The exceptions are covered elsewhere. RFC 6564 §5 limits the format to newly defined headers, and the legacy ones with other units (AH counts in 4-octet units, Fragment is a fixed 8) have their own classes, so they never fall back to IPv6_Ext.
The change would be:
ipv6_ext.py:586 returns 8, with the docstring updated to cite §4's length definition;
the pin test_length_hint_is_the_two_octets_rfc_6564_guarantees updated to match;
a regression test that a 2–7 octet unknown-header tail becomes Raw and rebuilds exactly.
Recorded: the maintainer confirmed option 2, so the fallback hint goes to 8, the minimum length under both RFC 6564 §4 and RFC 8200 §4. A worker is on it now.
Activity
JarryShaw commentedon Oct 7, 2026
What's your recommendation? I prefer RFC driven decisions but seems like both are based on RFCs.
JarryShaw commentedon Oct 7, 2026
My recommendation is option 2, raise the hint to 8. It turns out the two RFCs don't conflict: RFC 6564 sets the same minimum.
IPv6_Ext.The change would be:
ipv6_ext.py:586returns 8, with the docstring updated to cite §4's length definition;test_length_hint_is_the_two_octets_rfc_6564_guaranteesupdated to match;Rawand rebuilds exactly.Confirm and I'll dispatch it.
JarryShaw commentedon Oct 7, 2026
Okay confirmed. Option 2 it is.
JarryShaw commentedon Oct 7, 2026
Recorded: the maintainer confirmed option 2, so the fallback hint goes to 8, the minimum length under both RFC 6564 §4 and RFC 8200 §4. A worker is on it now.
fix(ipv6-ext): raise the fallback length hint to the RFC 8200 minimum (…