Skip to content

fix(ipv6): from_data(info.to_dict()) crashes when an IPv6_Ext stands in for a dedicated extension header #1473

Description

@JarryShaw

Bug. Rebuilding from to_dict() crashes when an IPv6 extension header was parsed by the generic IPv6_Ext fallback, which happens for example when the header is cut short. The dict path rebuilds the entry with the dedicated class (HOPOPT), which then misses the fields only it would have parsed.

Repro on main (94ae9664c):

hop = bytes([59,1]) + bytes([1,12]) + bytes(12)      # HOPOPT, 16 octets declared
raw = bytes([0x60,0,0,0]) + struct.pack('!HBB', 16, 0, 64) + b'\x00'*32 + hop[:10]
p = IPv6(raw, len(raw))                              # _exthdr holds an IPv6_Ext
IPv6.from_data(p.info.to_dict())                     # AttributeError: 'HOPOPT' object has no attribute 'options'

Cuts at 8, 10, 12 and 15 octets all fail the same way. The object form is unaffected.

The cause is in ipv6.py's dict path, around _lookup_exthdr, which #1466 changes. Found by the #1465 worker (107 cut cases).

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 9, 2026
  2. JarryShaw commented on Oct 9, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1466 merges. #1466 changes _lookup_exthdr in ipv6.py, where this fix goes. #1471 is in the same file and waits on the same condition.

  3. JarryShaw commented on Oct 9, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1466 merged (8328fd3bb). #1471 and #1473 both touch pcapkit/protocols/internet/ipv6.py, so one worker is taking both, rebased on current main.

  4. 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 9, 2026
  5. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 9, 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