Skip to content

fix(reassembly): unfragmented datagram with a buffered BUFID is dropped and flushes IPv6 #2270

Closed

Description

@JarryShaw

Describe the bug
In IP.reassembly, a datagram with FO 0 and MF clear whose BUFID is already buffered submits the old buffer and returns. The datagram itself is dropped. IPv6 inherits this, so a colliding atomic fragment also cuts short the datagram being reassembled.

Reproduction (Packet records, BUFID shared, strict=False; strict=True behaves the same)

IPv4: #1 FO=0 MF=1, #2 FO=0 MF=0      -> [((1,), PARTIAL)]          #2 alone -> [((2,), COMPLETE)]
IPv6: #1 FO=0 M=1, #2 atomic, #3 FO=16 M=0 -> [((3,), PARTIAL), ((1,), PARTIAL)]

Expected behavior
IPv4: RFC 791 §3.2 flushes the BUFID and then submits this datagram, so (1,) PARTIAL plus (2,) COMPLETE. IPv6: RFC 6946 §4 says an atomic fragment MUST be processed in isolation, and the queued fragments MUST NOT be discarded. That gives (2,) COMPLETE and (1, 3) COMPLETE. Suggested fix: after the flush, fall through and reassemble the IPv4 datagram on its own. On IPv6, complete the atomic fragment without touching self._buffer.

System information
Linux, CPython 3.14.9, pcapkit 1.5.0b14, checkout main 9d504ead5.

Activity

  1. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
  2. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    on Oct 26, 2026
  3. moved this to Pending in PyPCAPKiton Oct 26, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 26, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Oct 26, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 28, 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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions