Skip to content

fix(ipv6-opts): zero-length SMF_DPD option parses as H-DPD by reading the next option's type octet #1200

Closed

Description

@JarryShaw

Describe the bug
In HOPOPT and IPv6-Opts, an SMF_DPD option with Opt Data Len 0 parses as H-DPD instead of being rejected, so it cannot be rebuilt.

The H-DPD/I-DPD bit is taken from the forward-matched next octet, which here belongs to the following option. That octet is read twice: once as this option's mode bit, and again as the type of the next option. The parsed option reports length=2 with hav=b''.

To Reproduce
On origin/main (630f0a581):

  • HOPOPT(io.BytesIO(bytes.fromhex('3b00080080000000'))) parses SMFHashBasedDPDOption(length=2, hav=b'') followed by UnassignedOption(type=0x80).
  • HOPOPT.from_data(p.info) then raises ProtocolError: … empty Hash Assist Value (HAV).
  • The I-DPD form with length 0 already raises FieldValueError: invalid SMF I-DPD option length: 0.

Expected behavior
A zero-length SMF_DPD option raises FieldValueError in both modes, so a malformed option is never parsed into something that cannot be rebuilt.

Found during the #1194 cross-review. I re-ran it on main.

Activity

  1. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1199 merges, because both edit the HOPOPT/IPv6-Opts protocol and schema files.

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

    @JarryShaw
    OwnerAuthor

    Unblocked: #1201 merged. Held while the internet-v6 round-trip audit runs, so this fix can land together with any related HOPOPT/IPv6-Opts findings.

  4. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    A worker is on it now.

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