Skip to content

fix(l2tp): L2TPv2.from_data drops the L flag and the Length field #1172

Closed

Description

@JarryShaw

Describe the bug
L2TPv2.from_data drops the length-present (L) flag and the Length field, so a header that carries a Length does not round-trip.

To Reproduce
On main 748c10dce:

from pcapkit.protocols.link.l2tpv2 import L2TPv2
raw = bytes.fromhex('c802000c0001000000010002')   # ZLB ACK: T, L and S set, length=12
L2TPv2.from_data(L2TPv2(raw).info).data.hex()    # '88020001000000010002'

The parse reads length=12 with len=True, seq=True. The rebuild clears L (c8 → 88) and omits the 2-octet Length field.

Expected behavior
from_data(x.info).data == x.data. That means _make_data should carry the L flag and the length through to make(), as #1166 did for IPv4 and UDP.

Additional context
Found by the #1171 worker and confirmed by its cross-review. I re-ran the reproduction above myself.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    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
    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. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 7, 2026
  4. 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