Skip to content

feat(application): dissect RFC 9146 connection-ID DTLS records #2515

Closed

Description

@JarryShaw

Follow-up split out of #2437 (owner's choice, option 1).

DTLS records that use RFC 9146 connection IDs (content type tls12_cid, 25) fall back to Raw on main (#2441). RFC 9146 §4 places the CID after the sequence number, and its length is negotiated, not on the wire. So the parser needs the negotiated CID length (from the connection_id extension in the handshake), or an explicit caller-supplied length.

Scope: dissect tls12_cid records' header (epoch, sequence number, CID, length) and keep the encrypted payload as data. Take the CID length from the handshake when the same capture carries it, and otherwise from a caller-supplied value. Round-trips stay byte-exact.

Blocked: #2496 is reworking pcapkit/protocols/application/dtls.py right now. This unblocks when #2496's PR merges.

Activity

  1. added
    featPull requests that add a new capability (feat: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 1, 2026
  2. moved this to Blocked in PyPCAPKiton Nov 1, 2026
  3. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Unblock condition, stated so it can be checked: #2528 merges. It is reworking pcapkit/protocols/application/dtls.py.

  4. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    #2528 merged, but DTLS record parsing is next being changed by #2535, which chains every record in a datagram. Blocked: this unblocks when #2535's PR merges, so that connection-ID records build on the chained layout.

  5. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  6. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    #2603 has merged, so DTLS chains every whole record in a datagram. Unblocked. A worker is on the connection-ID records, building on that chaining and on the ProtocolBase value helpers from #2595.

  7. 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 Nov 2, 2026
  8. moved this from Blocked to WIP in PyPCAPKiton Nov 2, 2026
  9. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The connection-ID records are done locally and a Sonnet review is running.

    tls12_cid records parse as DTLS 1.2 layers, chained with the other records in their datagram. The connection ID length comes from the IDs the capture's own ClientHello and ServerHello negotiated, matched by value so the direction does not matter. A caller can also supply a DTLSContext. With no known length, the record stays Raw, quietly. The test vectors are a real Mbed TLS exchange, pinned against tshark's dissection. All other DTLS output is unchanged.

    Needs deciding. The branch implements the recommendations, so it proceeds unless you choose otherwise.

    1. DTLS 1.3 unified-header records that carry a connection ID stay Raw.
      • (a) A follow-up issue that reuses DTLSContext, with IDs from DTLS 1.3's encrypted NewConnectionId supplied by the caller.
      • (b) Fold it into this PR.
      • (c) Leave it as a documented limitation.
      • Recommend (a).
    2. A caller-supplied DTLSContext keeps the IDs it learns, so reusing one instance carries them into the next extraction.
      • (a) Keep it and document it.
      • (b) Keep learned IDs separate from the caller's object.
      • Recommend (a). Matching is by value, so a leftover ID matters only if it actually matches.
    3. The caller-supplied cid_length is a single value.
      • (a) Keep one value. Callers who know the IDs pass them as DTLSContext(*ids), which handles different lengths per direction.
      • (b) Add per-direction lengths.
      • Recommend (a).
  10. added
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 2, 2026
  11. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor
    1. (a)
    2. (a)
    3. (a)
  12. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The owner chose 1(a), 2(a) and 3(a), paraphrased: DTLS 1.3 CID records go to a follow-up, filed as #2625 and blocked on this one. A caller's DTLSContext keeps the IDs it learns, and this is documented. cid_length stays a single value. These are what the branch already implements, so nothing changes. It opens as a PR once the Sonnet review returns and the Actions queue drops below 20.

  13. removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 2, 2026
  14. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    DTLSContext's memory should go per instance. New instance should not still carry the historical context. It's that's what we're implementing.

  15. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    Owner ruling, paraphrased: DTLSContext's memory belongs to the instance. A new instance starts with no learned IDs, and nothing carries over through shared state. An extraction run without a caller's context gets a fresh instance of its own, so consecutive or concurrent extractions never share IDs. A caller who reuses an instance keeps what that instance learned. The fix round is checking the implementation against this and adding tests that fail if a shared store comes back.

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

    featPull requests that add a new capability (feat: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions