Skip to content

fix(ipv4): from_data does not round-trip the IPv4 header of http.pcap #1150

Closed as not planned

Description

@JarryShaw

Describe the bug
from_data does not round-trip the IPv4 header of examples/captures/http.pcap. Byte 33 reads 0x3c and rebuilds as 0x40, probably the total length or IHL. By contrast, ipv4.pcap and big_endian_nanosecond.pcap round-trip fully.

Reproduction
With #1147 applied, run Frame.from_data(frame.info, num=..., header=...) over http.pcap and compare the result with the original bytes.

Expected behavior
Every IPv4 header in the tracked captures round-trips byte for byte. Check options, padding and whether the total length is recomputed.

Additional context
Found by the #1126 worker. Not yet reproduced independently.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 6, 2026
  2. JarryShaw commented on Oct 6, 2026

    @JarryShaw
    OwnerAuthor

    This is not an IPv4 bug. Byte 33 is the low byte of the IPv4 total length (16 + 14 + 3), which goes from 60 to 64. IPv4.make() computes it correctly as ihl*4 + len(payload). The payload TCP.from_data returns is 4 bytes too long because _make_tcp_options (tcp.py:2029-2116) drops the original NOPs and re-pads each option separately. Tracked in #1151.

    A sweep of all 23 captures found no IPv4 field wrong once the TCP and HTTP payload faults are set aside.

  3. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 6, 2026
  4. moved this to Done in PyPCAPKiton Oct 6, 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