Skip to content

fix(engines): TCP trace flows disagree between engines on snapped frames and on IPv4 total_length=0 #1518

Closed

Description

@JarryShaw

On main 6af87f608, I derived two captures from examples/captures/tcp.pcap and traced them. The engines produce different TCP flows:

Capture default dpkt scapy
unmodified tcp.pcap (2,6) (3,) (4,5) same same
every frame snapped by 4 octets (PCAP-NG, orig_len kept) (3,5) (6,) (1,2,6,7) (3,4,5) (1,2,6,7) (3,4,5)
IPv4 total_length zeroed, as TSO captures do (3,4,5) (1,2,6,7) (3,4,5) (1,2,6,7) (3,4,5)

The first row comes from #1508. The other two are my measurements. Two things look wrong:

  • the default engine drops frames once IP's length no longer matches the captured length;
  • dpkt and scapy merge flows, giving a different grouping from the unmodified capture.

I have not established which engine is right, or why. That is the first step.

The #1511 review found this. It is blocked until #1511 merges, because that PR is editing the dpkt and scapy toolkits.

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 10, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1511 has merged. A read-only investigation is starting on the first step: which engine groups the snapped and zeroed-total_length captures correctly, and why the others differ. Fixes follow once the cause is known.

  3. 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 10, 2026
  4. moved this from Blocked to WIP in PyPCAPKiton Oct 10, 2026
  5. JarryShaw commented on Oct 10, 2026

    @JarryShaw
    OwnerAuthor

    Investigation done, and I re-derived the rows myself. dpkt, scapy and Wireshark (tcp.stream) are right; the default engine is wrong, for two separate reasons.

    Capture default dpkt / scapy / Wireshark
    tcp.pcap (1,2,6,7) (3,4,5) same
    snapped by 4 octets (3,5) (6,) (1,2,6,7) (3,4,5)
    IPv4 total_length = 0 (3,4,5) (1,2,6,7) (3,4,5)

    The issue's first row was wrong: (2,6) (3,) (4,5) is the one-direction view with (1,7) left out. That also undoes the "dpkt and scapy merge flows" reading. Every engine follows the documented definition, one flow per endpoint pair (traceflow/tcp.py:50-62).

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