Skip to content

fix(ipv6-ext): the IPv6_Ext fallback length hint is 2, below the RFC 8200 minimum #1178

Closed

Description

@JarryShaw

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.

  1. Keep 2. The fallback class trusts only what RFC 6564 guarantees.
  2. 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.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Oct 7, 2026
  2. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    What's your recommendation? I prefer RFC driven decisions but seems like both are based on RFCs.

  3. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    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.

    Confirm and I'll dispatch it.

  4. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Okay confirmed. Option 2 it is.

  5. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    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.

  6. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    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
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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions