Skip to content

fix(dpkt): extract(engine='dpkt') lets a raw AttributeError escape on an IPv6 Fragment header followed by ESP or Destination Options #1351

Closed

Description

@JarryShaw

Describe the bug
dpkt 1.9.8 dpkt/ip6.py:96 evaluates ext.frag_off for any header whose predecessor has nxt == 44, so an IPv6 Fragment header followed by ESP (50) or Destination Options (60) raises AttributeError: 'IP6ESPHeader' object has no attribute 'frag_off'. That is upstream, but pcapkit/foundation/engines/dpkt.py:163 (packet = protocol(pkt)) does not catch it, so the raw error aborts the whole extraction instead of an in-library error.

To Reproduce
One Ethernet frame, IPv6 nxt=44, Fragment header 32 00 00 00 00 00 00 01 (next header ESP, offset 0, M=0) + 8 octets, in a pcap:
pcapkit.extract(fin='x.pcap', engine='dpkt', nofile=True, store=False) -> AttributeError: 'IP6ESPHeader' object has no attribute 'frag_off'. Next header 60 (payload 3b00010400000000) raises 'IP6DstOptsHeader' ... 'frag_off'.

Expected behavior
The engine converts a dpkt parse failure into a pcapkit error (or skips the frame with a warning) rather than leaking the third-party exception.

Reproduced on main at c9676c5 (check D5).

Found by the PR cross-review follow-up round-trip audit (#1202). The repro was re-checked by an independent verifier, and I re-ran it on main at c9676c563.

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. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1335 merges, because both edit pcapkit/foundation/engines/dpkt.py. The uncaught call is engines/dpkt.py:163 (packet = protocol(pkt)); the raise itself is upstream in dpkt 1.9.8 dpkt/ip6.py:96.

  3. 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
  4. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1335 merged at 20:41Z. Back to pending.

  5. added
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    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
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 8, 2026
  7. added this to the PyPCAPKit v1.5 milestone on Oct 26, 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