Skip to content

fix(pcapng): epb_flags / pack_flags bits are numbered MSB-first, against the spec's LSB numbering #1273

Closed

Description

@JarryShaw

Describe the bug
BitField numbers bits MSB-first over the raw octets and ignores byte order (pcapkit/corekit/fields/strings.py:241-258), but the flags namespaces (pcapkit/protocols/schema/misc/pcapng.py:1264-1275, and the pack_flags twin) use the spec's LSB-0 numbering (direction = bits 0-1, FCS length = bits 5-8). Verified against the spec text: "bits are numbered with 0 being the least-significant bit".

To Reproduce

make(direction=INBOUND) -> 02000400 40000000   (want 01000000)
make(fcs_len=4)        -> 02000400 02000000   (want 80000000)
wire flags 0x00000001 (LE) parses as direction=UNKNOWN, fcs_len=2
wire flags e5010000 -> ValueError: 3 is not a valid PacketDirection

Expected behavior
Wire 0x1 decodes as inbound; make(direction=INBOUND) writes 0x1.

Found by the misc round-trip audit (#1202). The repro was re-checked by an independent verifier, and I re-ran it on main at 11ae68ebf.

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. moved this to Pending in PyPCAPKiton Oct 7, 2026
  3. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until the PCAP-NG K1-K5 PR (#1267-#1271) merges.

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

    @JarryShaw
    OwnerAuthor

    Unblocked: #1339 merged at 20:42Z. Back to pending.

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