Help Wanted

Important

This page is the maintained copy of the project’s enhancement proposals, kept in step with the code. The discussion thread holds them as first raised; here an implemented proposal is described as implemented, and only open work is asked for. Leave notes in the thread rather than against this page.

Pull requests for anything still open, and new ideas of your own, are very welcome. For questions, leave a note in the discussion thread or under the Q&A category.

Note

This page tracks feature requests, not defects. A defect that work on an item turns up goes in the issue tracker and is linked from here. A design question that needs a decision before anyone can implement it is a request, and belongs here.

Wish you enjoy PyPCAPKit!!!

More Protocols, More!!!

Every protocol not decoded is wanted. Adding one is self-contained: a package holding a protocol, a schema and a data class (Protocol Family Grouping), as sketched in discussion #251, whose reply is the closest thing to a step-by-step guide. Outstanding, by TCP/IP layer and alphabetically, each with its issue:

QUIC and RSVP sit where #2805 placed them: QUIC in transport, and RSVP in application beside OSPF.

For a protocol pycrate ships, pcapkit dissects the protocol structure itself, and ASN.1 or XML payloads go through pycrate or another parser, as NGAP does (#3106).

Done: PPP and PPPoE (#2817), DNS (#2816), and MLDv1 and MLDv2 in ICMPv6 (#2812).

Neighbor Discovery (#2934) is still open. Its messages (RFC 4861), ICMPv6 types 133 to 137, belong to ICMPv6 rather than to a protocol of their own; like any type ICMPv6.__type__ does not register, each is read today down to its type, code and checksum, with its body kept raw.

ECN is decoded where its bits are a field of their own: IPv4’s as tos.ecn, a ToSECN, beside its precedence and type-of-service bits, and TCP’s as the ns, cwr and ece flags. IPv6 keeps its Traffic Class as one integer, class; splitting it into DSCP and ECN is #3000.

Several protocols came in pairs that wanted a shared abstract base rather than two independent implementations, in the way IP and IPsec cover their families. Done: ICMP is the base of ICMPv4 and ICMPv6, LinuxSLL that of the two Linux cooked-capture headers, and SSLv2, TLS and DTLS share SSL as their base by name, and only TLS and DTLS share its record layer – see the DTLS section below. VLAN is the closer precedent for a pair whose layout is identical – it holds the whole of the tag, and C_Tag and S_Tag add only how each names itself.

Note

Some of these have an empty, protocol-named file under a NotImplemented folder. Those files are not a roadmap. They are scratch reminders, so a stub’s presence does not mean a protocol is planned or claimed, and its absence does not mean the protocol is unwanted: QUIC has no stub and is on the list above, while NGAP has none either and is implemented. Take this page as the record and ignore the folder.

SCTP

Done. SCTP is a first-class transport layer protocol implemented per RFC 9260: the common header, every chunk type, chunk parameter and error cause the RFC defines, and CRC32c checksum verification. It also reads and builds the I-DATA and I-FORWARD-TSN chunks (RFC 8260), the FORWARD TSN chunk and Forward-TSN-Supported parameter (RFC 3758), the PAD chunk and Padding parameter (RFC 4820), and the Supported Extensions parameter (RFC 5061) (#2811).

Unlike its siblings, it dispatches the next layer on the payload protocol identifier of the first DATA or I-DATA chunk through register_sctp(), not on port numbers, so register_apptype() deliberately does not fan out to it.

Still wanted are the registered-but-unimplemented type codes. IANA registers more chunk types, chunk parameters and error causes than these (SCTP Constant Enumerations lists them), and the surplus falls through to the generic handlers: a capture using one parses, but yields an opaque chunk instead of its fields. AUTH, ASCONF, ASCONF-ACK, RE-CONFIG and the DTLS chunk, with their parameters and error causes, and the Zero Checksum Acceptable parameter, are #2989.

SCTP also wants its user messages reassembled (#2935) and every DATA or I-DATA chunk of a bundle dispatched, not only the first (#2993) – see Reassembly Beyond IP and TCP below.

ESP

Done. ESP parses without keys, and decrypts when a Security Association is supplied through the protocol keyed pcapkit.corekit.context channel.

Still wanted is wider algorithm coverage. The enumerations under ESP Constant Enumerations – Cipher and Integrity – carry every transform IANA has registered, but CIPHER_SUITES and INTEGRITY_SUITES apply only a few of them, the no-ops ENCR_NULL and NONE among them. So the real coverage is AES-CBC and AES-GCM at every tag length for encryption, and HMAC-SHA1-96 plus the RFC 4868 HMAC-SHA2 truncations for integrity.

Not implemented, roughly in the order a capture is likely to want them: AES-CTR [RFC 3686], AES-CCM at every tag length [RFC 4309], ChaCha20-Poly1305 [RFC 7634], AES-XCBC-MAC-96 [RFC 3566], AES-CMAC-96 [RFC 4494], the AES-GMAC family and its ENCR_NULL_AUTH_AES_GMAC counterpart [RFC 4543] and the Camellia family, all #2958; then the implicit-IV [RFC 8750] family, with Extended Sequence Numbers (#2963), and the MGM [RFC 9227] family (#3009). Extended Sequence Numbers are the one item on this list that is not simply a table entry: the high-order 32 bits are never transmitted, so recovering them is stateful, and they widen both the ICV coverage and the AEAD associated data.

The structure limits what a new row can do. Adding an integrity algorithm that is not an HMAC needs more than a row – IntegritySuite records the digest as the name of a hashlib constructor, which AES-XCBC and AES-CMAC are not. And load_cryptography() imports only the ciphers submodules of cryptography, so the AEAD and CMAC primitives have to be added there before a cipher suite can reach them. Unsupported algorithms are refused loudly, when the Security Association is constructed rather than when a packet is read, so nothing decodes wrongly in the meantime.

Mobility Header

Done. MH decodes and constructs the whole registry: every registered message data type, every CGA extension, and every registered option. Every one of them is registered in __message__, __option__ or __extension__ with both a _read_ and a _make_ handler.

Every message type and every one of those options round-trips byte-for-byte through the public API – make then read then make again reproduces the same octets, which tests/protocols/test_option_roundtrip_unit.py checks for the whole registry. The CGA extensions round-trip end to end as well: the CGA Parameters option (type 12) is the only thing that can carry a CGA extension on the wire, so registering it reached the whole __extension__ registry with it, and no mh-extension entry appears in that test’s EXPECTED_FAILURES.

The sub-registries are the easy half: binding revocation types and triggers, handoff indicators, access network identifier sub-options, flow identification and flow binding sub-options, LMA-controlled MAG parameters, DNS update status, traffic selector formats and QoS attributes are all generated in full under MH Constant Enumerations. Value sets that IANA does not register live in pcapkit.protocols.internet.mh.protocol rather than in pcapkit.const.mh: the localized routing acknowledgment status codes of RFC 6705 Section 10.2 (LocalizedRoutingStatus) and the local mobility anchor address option codes of RFC 5949 Section 6.2.2 (LMAAddressCode). Sets from RFC 5568 live there alongside them.

What is left, and why:

  • Payloads that belong to another protocol are carried opaquely. The multicast options (54, 56, 57, 60 and 61) embed RFC 3810 MLD or RFC 3376 IGMP address records, and the traffic selectors of RFC 6089 and RFC 7222 embed the flag-driven range lists of RFC 6088. Each is a separate registry with its own dissector’s worth of structure; the mobility options around them are fully decoded, and each records which format its payload is in.

    What is wanted is to carry these as Raw rather than as bare bytes, dispatched through a per-payload registry in the style of MH.__option__, keyed on the field that already names the format – ts_format for the traffic selectors, and on the multicast options the message-type octet each carries: protocol on option 54, igmp_type and mld_type on 56 and 57, and code on 60. Not the M flag on option 54, which selects the routing mode rather than the record format [RFC 7028 Section 5.1.2]. Raw is already what an unregistered dispatch falls back to everywhere else in the package, so this makes the mobility header consistent with the rest rather than inventing a convention; and once a dissector for one of these formats exists, registering it needs no change at the option site. The registry is #2937; the dissectors it would register are #2994 for the MLD and IGMPv3 records and #2990 for the RFC 6088 traffic selectors.

    None of those keys is checked against the values its RFC allows, on either side. RFC 7028 says protocol MUST be 143 or 131 for MLD, or 0x12, 0x16 or 0x22 for IGMP, yet _make_opt_mcast_sel() builds and _read_opt_mcast_sel() parses any octet without a warning, and the other keys behave the same. The registry is where an unknown key would first be noticed, so the check belongs there rather than in each maker separately, and #2937 carries it.

    It wants a registry of its own rather than _decode_next_layer(), which is only ever called at a layer boundary and appends to the frame’s protocol chain. An MLD address record inside a mobility option does not follow MH on the wire, so putting it in that chain would make layer= and protocol= limits behave wrongly. Changing the parsed shape from bytes to Raw also changes what existing captures dump to, so it is its own change.

Wire-format traps are worth knowing before touching this code, since each looks like an ordinary field and is not:

  • RFC 7411’s multicast options measure their length field in 32-bit words, and exclude the option-code and status octets as well as the type and length ones – so the option occupies 4 + length * 4 octets, not length + 2.

  • RFC 5213 Section 8.8’s timestamp is not an RFC 1305 NTP timestamp, though the mobility header carries both. It counts from the UNIX epoch in a 48/16 fixed-point split, where NTP counts from 1900 in a 32/32 one, so reading one as the other is wrong in the epoch and in both field widths. They have separate types for that reason: PMIPv6Timestamp and NTPTimestamp.

DTLS

Done for the record layer and handshake message framing: TLS (SSLv3, RFC 6101; TLS 1.0, RFC 2246; TLS 1.1, RFC 4346; TLS 1.2, RFC 5246; TLS 1.3, RFC 9846) and DTLS (DTLS 1.0, RFC 4347; DTLS 1.2, RFC 6347; DTLS 1.3, RFC 9147) share SSL as their record-layer base – content type, legacy version, length, and content-type dispatch – with DTLS’s own divergence (the epoch/sequence-number pair in its record header, and the fragment header each handshake message carries) staying in DTLS alone. ClientHello and ServerHello decode down to their cipher suite(s), compression method(s) and extension list, and EncryptedExtensions down to its extension list. An extension body decodes where SSL.__extension__ registers a decoder for its type, as it does for the extensions a current hello carries (#2810), and only in the messages its RFC defines it in; it stays raw octets elsewhere, where none is registered, or where the decoder rejects it (#2514). Decoding the other extensions IANA registers is #2966. Every other handshake message is message-TYPE-level framing only; decoding their bodies, and heartbeat and ACK records, is #2969. Decryption is a separate question and is not needed to make the record structure legible, in the same way ESP parses without keys. Still open: a TLS record split across TCP segments is not reassembled, and stays Raw (#2938).

Done for SSLv2 too (draft-hickman-netscape-ssl-00, #2457): SSLv2 shares SSL by name only, since its 2- or 3-octet record header carries no content type and no 0x03xx version. No port binds it: on TCP port 443, TLS offers it a segment whose first record TLS rejects, and adopts the parse only when that record is a complete CLIENT-HELLO or SERVER-HELLO, keeping anything else Raw. A whole record after the first is a further layer, the previous record’s payload (#2567), with the exceptions pcapkit.protocols.application.sslv2.protocol lists. Among them, a record with a RECORD-LENGTH of 0 is Raw together with everything after it, and FRAME_LAYER_LIMIT bounds how many are dissected. The SSL Family gives how id() and alias tell the family’s members apart.

Done: reassembling a handshake message DTLS has fragmented across several records (RFC 6347 Section 4.2.3, #2440), via DTLS, keyed on the UDP 4-tuple and the epoch. reassembly=['dtls'] opts in, on the default engine alone, which feeds it through the dtls_reassembly adapters of pcapkit.toolkit.pcap and pcapkit.toolkit.pcapng, and dtls_handshake() decodes each reassembled message, of any length (#2496). In the frame itself every fragment’s body stays that one fragment’s raw octets – see DTLSHandshake.is_fragmented. An unfragmented message is unaffected either way.

NGAP over DTLS over SCTP (PPID 66, PayloadProtocolIdentifier), asked for in discussion #251, is not decoded: SCTP.__proto__ maps PPID 66 to NGAP rather than through DTLS, so those bytes degrade to Raw. Rewiring that dispatch is #2971, which needs a decision on what an undecrypted DTLS-wrapped NGAP PDU reports.

Registered, but Not Dissected

A gap easy to miss, because nothing announces it. The Protocol Type Registry Constant Enumerations enumerations are complete, but only a small part of each is bound to a dissector; everything else resolves to Raw, so the capture parses without complaint and yields nothing useful.

  • LinkType – NULL, ETHERNET, PPP, PPP_HDLC, PPP_ETHER, IEEE802_11, FRELAY, LOOP, LINUX_SLL, IEEE802_11_RADIOTAP, IPV4, IPV6 and LINUX_SLL2, declared identically in Frame and PCAPNG, which also read RAW as IPV4 or IPV6 by its version nibble.

  • TransType – the values in Internet.__proto__.

  • EtherType – the values in Link.__proto__: ARP, RARP, IPv4, IPv6, IPX, PPP, both PPPoE stages and both VLAN tags.

  • AppType – the ports bound in TCP.__proto__ and UDP.__proto__, out of a registry carrying every IANA service name: TCP 20 to FTP-DATA, 21 to FTP and 443 to TLS, ports 53 to DNS and 80 and 8080 to HTTP on both TCP and UDP, and UDP 1701 to L2TPv2 and 5684 to DTLS. DCCP.__proto__, keyed by the same registry, binds no port, so every DCCP payload is Raw until something calls register_dccp(); binding its syslog-tls and avt-profile ports is #2999.

  • ARPHRD – the values in LinuxSLL.__proto__ (#2510), each an arphrd_type neither Linux cooked-capture header reads as an EtherType (#2460): NETLINK, IPGRE, IP6GRE, FRAD and IEEE80211_RADIOTAP. Behind radiotap, IEEE802_11 dissects the MAC header and keeps the frame body Raw (#2575): a data frame’s LLC/SNAP is #2936, and management frame bodies are #2975.

  • PayloadProtocolIdentifier – the values in SCTP.__proto__: PPIDs 60 and 66, each to NGAP. Every other DATA chunk payload is Raw until something calls register_sctp(). The PPIDs a document formats are planned: the ones carried over DTLS (#2971, and 4242 in #2989), the SIGTRAN adaptation layers (#3016), Diameter (#3019), WebRTC’s data channels (#3015), the 3GPP and O-RAN application protocols (#3012, #3018), ITU-T signalling (#3021) and the other RFC-specified ones (#3010). Not Planned lists the rest.

How much of each registry is bound is measurable:

python -c "from pcapkit.protocols.internet.internet import Internet; \
           from pcapkit.const.reg.transtype import TransType; \
           print(len(Internet.__proto__), len(list(TransType)))"

Most of those want a dissector written, and are the protocols listed above. Some wanted only a table entry, because the dissector was already there:

  • Done. OSPF is bound at TransType 89 (OSPFIGP) and L2TPv2 at UDP port 1701, and __index__ returns those values: TransType.OSPFIGP, and 1701 as an int, as an AppType-valued index is the member’s port (The Registry Index).

  • Done. FTP_DATA is bound at TCP port 20 (IANA ftp-data). It is a thin Raw subclass, so this buys the payload a name rather than a parse – which is the right answer for a data channel carrying an arbitrary file.

  • Done. HTTP is additionally bound on 8080 (IANA http-alt, “HTTP Alternate (see port 80)”) on both TCP and UDP. TCP 443 (IANA https) is bound to TLS and UDP 5684 (IANA coaps) to DTLS. 8443 is unbound: IANA registers it as pcsync-https, not as an HTTP alternate, so binding it to HTTP would feed a TLS record to an HTTP parser. Binding TCP 8443 to TLS, and leaving UDP 8443 unbound, is #3017, as the owner ruled on #2805.

  • Done. The service VLAN tag identifier (S-Tag), 0x88A8, is bound to S_Tag, and the customer tag 0x8100 to C_Tag. Both subclass the abstract VLAN, which carries the shared tag layout; the split exists so that a Q-in-Q frame’s two tags stay distinct in the parsed output.

  • Done. LinkType NULL and LOOP are bound to Loopback, which reads the four-octet address family word and hands 2 to IPv4 and 24, 28 or 30 to IPv6 (#1574). RAW has no binding of its own: its bare IPv4 or IPv6 is dispatched by the version nibble of the first octet (#1502). Neither NULL nor RAW stands in for an unknown link type: the toolkit raises for a link-layer name it cannot resolve rather than defaulting to LinkType.NULL.

Follow-ups to the bindings above:

Done. ICMP (1), IGMP (2), DCCP (33), GRE (47) and ICMPv6 (58) – the IP protocol numbers most likely to be met in a real capture – are all implemented and bound.

Planned for 2.x

Planned for the minor releases after 2.0.0, as ruled on #3106. Their issues are not filed yet. Each line names a protocol and where it binds. ERSPAN, Ethernet CFM, the quoted invoking packet and the 802.11 protected-frame headers each need a ruling before they are filed. An EtherType marked IEEE is assigned by the IEEE but missing from IANA’s list, which EtherType follows. Every one of them waits on the same ruling: whether to crawl the IEEE Registration Authority’s list as a second source (#3106, question 5).

Next:

  • Link Layer:

    • CAPWAP’s header, DTLS preamble and data channel – UDP ports 5246 and 5247

    • Enhanced GRE – GRE version 1, at IP protocol 47

    • ERSPAN types I to III – GRE protocol types IEEE 0x88BE and 0x22EB

    • Ethernet Configuration Testing Protocol – EtherType 0x9000

    • IEEE 802.11 protected-frame headers – the frame control’s Protected bit

    • MAC Control PAUSE and PFC – EtherType 0x8808

    • MACsec’s SecTAG – EtherType 0x88E5

    • MPLS in IP and in UDP – IP protocol 137, and UDP ports 6635 and 6636

    • Netlink, SCTP and PPP-with-direction captures – LinkTypes 253, 248 and 204

    • NFLOG – LinkType 239

    • pflog – LinkType 117

  • Internet Layer:

    • The invoking packet quoted in ICMP errors – ICMPv4 types 3, 4, 5, 11 and 12, and ICMPv6 types 1 to 4

  • Transport Layer:

    • GRE in UDP – UDP ports 4754 and 4755

  • Application Layer:

    • DCE/RPC’s connection-oriented and connectionless PDUs – TCP and UDP port 135, and SMB named pipes

    • EIGRP – IP protocol 88

    • HSRP version 1 – UDP port 1985

    • IPFIX – TCP and UDP port 4739, with NetFlow v9 as a class bound to no port

    • IS-IS – NLPID 0x83 behind LLC SAP 0xFE and FRAD, and EtherType 0x22F4

    • LDAP at msft-gc – TCP port 3268

    • LDP – TCP and UDP port 646

    • NFSv3, MOUNT and NLM – ONC RPC programs 100003, 100005 and 100021

    • PIM version 2 – IP protocol 103

    • PTP (IEEE 1588) – EtherType 0x88F7, and UDP ports 319 and 320

    • RTSP – TCP ports 554 and 8554

    • STUN and TURN – TCP and UDP port 3478

    • TACACS+ – TCP port 49

    • TFTP with options – UDP port 69

    • TPKT, X.224 class 0 and RDP’s negotiation – TCP ports 102 and 3389

On demand:

  • Link Layer:

    • ATM AAL5 with LLC/SNAP – LinkTypes 100, 106 and 123

    • CAPWAP’s control message elements – UDP port 5246

    • Cisco HDLC and SLARP – LinkTypes 104 and 112

    • EFM OAM – Slow Protocols subtype 3, at EtherType 0x8809

    • Endace ERF – LinkType 197

    • EPON’s preamble and 802.3br’s mPacket – LinkTypes 259 and 274

    • EtherIP – IP protocol 97

    • Ethernet CFM – EtherType IEEE 0x8902

    • MVRP and MMRP – EtherTypes 0x88F5 and 0x88F6

    • Netlink’s route and netfilter payloads – Netlink protocols 0 and 12

    • NSH – EtherType 0x894F and IP protocol 145

    • OpenVPN – TCP and UDP port 1194

    • PBB’s I-TAG – EtherType 0x88E7

    • PKTAP, enc and IPNET capture headers – LinkTypes 258, 109 and 226

    • Prism, AVS and PPI capture headers – LinkTypes 119, 163 and 192

    • Teredo – UDP port 3544

    • Token Ring – LinkType 6

    • VXLAN-GPE – UDP port 4790

  • Internet Layer:

    • HIP and ESP in UDP – UDP port 10500

  • Transport Layer:

    • UDP-Lite – IP protocol 136

  • Application Layer:

    • CoAP – TCP and UDP port 5683

    • HTTP/2’s HPACK – the HEADERS, PUSH_PROMISE and CONTINUATION frames

    • Mobile IPv4 registration – UDP port 434

    • MPLS LSP Ping – UDP port 3503

    • OpenFlow – TCP port 6653

    • PCP and NAT-PMP – UDP ports 5350 and 5351

    • PPTP’s control connection – TCP port 1723

    • RFB – TCP port 5900

    • RMCP, ASF and IPMI over LAN – UDP ports 623 and 664

    • RPKI to Router – TCP port 323

    • sFlow v5 – UDP port 6343

    • SLPv2 – TCP and UDP port 427

    • SOCKS 4 and 5 – TCP port 1080

    • TWAMP and STAMP – TCP and UDP port 862

On demand, by domain. A protocol with no registered identifier is listed as such. Vendor-proprietary protocols with no public specification, and vendor- or tool-internal link types, stay out, as work with no specification is wontfix (#2805).

  • Automotive:

    • AUTOSAR’s DLT – no registered identifier

    • AUTOSAR’s PDU transport – no registered identifier

    • AUTOSAR’s SecOC – no registered identifier

    • CAN and CAN FD – LinkType 227

    • CCP – no registered identifier, above CAN

    • DoIP – TCP and UDP port 13400

    • FlexRay – LinkType 210

    • GeoNetworking – EtherType 0x8947

    • ISO-TP – no registered identifier, above CAN

    • KWP2000 – no registered identifier, above CAN

    • LIN – LinkType 212

    • OBD-II – no registered identifier, above CAN

    • SOME/IP – no registered identifier

    • UDS – no registered identifier, above ISO-TP and DoIP

    • WAVE’s WSMP – EtherType IEEE 0x88DC

    • XCP – no registered identifier

  • Broadcast and media:

    • ATSC ALP – LinkType 289

    • DSM-CC – no registered identifier, inside MPEG-2 TS

    • DVB IPDC – no registered identifier, inside MPEG-2 TS

    • GigE Vision’s GVCP – UDP port 3956

    • HiQnet – TCP and UDP port 3804

    • IEEE 1722 AVTP – EtherType IEEE 0x22F0

    • IEEE 802.1CB’s R-TAG – EtherType IEEE 0xF1C1

    • IEEE 802.1Q’s MSRP – EtherType IEEE 0x22EA

    • MMS – TCP port 1755

    • MPEG-2 TS – LinkType 243

    • RTMP – TCP port 1935, IANA’s macromedia-fcs

    • SAP – UDP port 9875

    • VITA 49 – UDP port 4991

  • Cable and broadband access:

    • ANCP – TCP port 6068

    • DOCSIS – LinkTypes 143 and 273

    • PacketCable’s COPS – TCP port 2126

  • Databases:

    • Firebird – TCP port 3050

    • memcached – TCP and UDP port 11211

    • MongoDB – TCP port 27017

    • MySQL – TCP port 3306

    • PostgreSQL – TCP port 5432

    • Redis – TCP port 6379

    • TDS – TCP port 1433

  • Developer tools and frameworks:

    • Bazaar – TCP port 4155

    • CVS’s pserver – TCP port 2401

    • distcc – TCP port 3632

    • Erlang’s EPMD – TCP port 4369

    • Gearman – TCP port 4730

    • git – TCP port 9418

    • HiSLIP – TCP port 4880

    • Java RMI – TCP port 1099

    • LeCroy VICP – TCP port 1861

    • .NET Message Framing – no registered identifier

    • .NET Remoting – no registered identifier

    • Performance Co-Pilot – TCP port 44321

    • RTPS (DDS) – UDP ports 7400 and 7401

    • rsync – TCP port 873

    • SANE – TCP port 6566

    • TCPROS – no registered identifier

    • Zabbix – TCP ports 10050 and 10051

  • DTN, space, MANET, aviation and amateur radio:

    • AODV – UDP port 654

    • ASTERIX – no registered identifier

    • AX.25 – LinkTypes 3 and 202, and IP protocol 93

    • BPQ – EtherType 0x08FF, outside IANA’s list

    • Bundle Protocol – UDP port 4556, and over TCPCL

    • DLEP – TCP and UDP port 854

    • DMP – UDP port 5031

    • DSR – IP protocol 48

    • GMPLS LMP – UDP port 701

    • LTP – UDP port 1113

    • OLSR – UDP port 698

    • PacketBB – UDP port 269

    • STANAG 4607 – no registered identifier

    • STANAG 5066 – TCP port 5066

    • TCPCL – TCP port 4556

  • GTP, PFCP and the 3GPP core, under the pycrate rule above:

    • A21 – UDP port 23272, IANA’s s102

    • CBSP – TCP port 48049

    • DECT – no registered identifier

    • eCPRI – EtherType IEEE 0xAEFE

    • GPRS LLC – LinkType 169

    • GSM Um – no registered identifier, inside GSMTAP

    • GSMTAP – UDP port 4729

    • GTP’ – TCP and UDP port 3386

    • GTP-U – UDP port 2152

    • GTPv1-C – UDP port 2123

    • GTPv2-C – UDP port 2123

    • IPDR/SP – TCP port 4737

    • OMA ILP – TCP port 7276

    • OMA ULP – TCP port 7275

    • PFCP – UDP port 8805

    • PPP’s VSNCP – PPP protocol 0x805B

    • PPP’s VSNP – PPP protocol 0x005B

    • ROHC – IP protocol 142 and EtherType IEEE 0x22F1

    • SGsAP – SCTP port 29118

    • WAP’s WSP – UDP port 9200, and 9201 over WTP

    • WAP’s WTLS – UDP ports 9202 and 9203

    • WAP’s WTP – UDP port 9201

    • WiMAX’s ASN control plane – UDP port 2231

  • Industrial and fieldbus:

    • ARCNET – LinkTypes 7 and 129

    • BACnet/IP – UDP port 47808

    • C12.22 – TCP and UDP port 1153

    • CNIP – TCP and UDP ports 1628 and 1629

    • DLMS/COSEM – TCP and UDP port 4059

    • DNP3 – TCP and UDP port 20000

    • EtherCAT – EtherType IEEE 0x88A4

    • EtherNet/IP – TCP port 44818, and UDP ports 2222 and 44818

    • EtherNet/IP’s DLR – EtherType 0x80E1

    • FOUNDATION Fieldbus HSE – TCP and UDP ports 1089 to 1091

    • HART-IP – TCP and UDP port 5094

    • HSR – EtherType IEEE 0x892F

    • IEC 60870-5-104 – TCP port 2404

    • IEC 61850’s GOOSE – EtherType IEEE 0x88B8

    • IEC 61850’s Sampled Values – EtherType IEEE 0x88BA

    • KNXnet/IP – TCP and UDP port 3671

    • LLRP – TCP port 5084

    • Modbus – TCP port 502

    • OPC UA – TCP port 4840

    • POWERLINK – EtherType IEEE 0x88AB

    • PRP – EtherType IEEE 0x88FB for its supervision frames

    • PROFINET – EtherType IEEE 0x8892

    • SERCOS III – EtherType IEEE 0x88CD

    • TRDP – UDP ports 17224 and 17225

    • TTEthernet – no registered identifier

  • IoT and IEEE 802.15.4:

    • 6LoWPAN – EtherType 0xA0ED, and above IEEE 802.15.4

    • AllJoyn – TCP and UDP port 9955

    • Bluetooth’s ATT – no registered identifier, above L2CAP

    • Bluetooth’s BR/EDR baseband – LinkType 255

    • Bluetooth’s HCI – LinkTypes 187 and 201

    • Bluetooth’s L2CAP – no registered identifier, above HCI and the LE link layer

    • Bluetooth’s LE link layer – LinkTypes 251, 256 and 272

    • Bluetooth’s Linux monitor – LinkType 254

    • Bluetooth’s SMP – no registered identifier, above L2CAP

    • DECT NR+ – LinkType 301

    • IEEE 802.15.4 – LinkTypes 195, 215, 230 and 283

    • IrDA – LinkType 144

    • LoRaTap – LinkType 270

    • LoRaWAN – no registered identifier, above LoRaTap

    • MQTT-SN – no registered identifier

    • Thread’s MLE – UDP port 19788

    • UWB’s UCI – LinkType 299

    • Wi-SUN – no registered identifier, above IEEE 802.15.4

    • ZEP – UDP port 17754

    • ZigBee – no registered identifier, above IEEE 802.15.4

  • ITU-T and telephony signalling, beyond #3021:

    • BIT-EMU – IP protocol 147

    • CESoETH – EtherType IEEE 0x88D8

    • DPNSS – no registered identifier

    • ESMC – Slow Protocols subtype 10, at EtherType 0x8809

    • GFP – LinkTypes 170 and 171

    • H.501 – TCP and UDP port 2099, IANA’s h2250-annex-g

    • IAX2 – UDP port 4569

    • LAPB – LinkType 207

    • MEF’s E-LMI – EtherType IEEE 0x88EE

    • MGCP – UDP ports 2427 and 2727

    • MIKEY – UDP port 2269

    • MRCPv2 – no registered identifier

    • MSRP (RFC 4975) – TCP port 2855

    • MTP2 – LinkTypes 139 and 140

    • MTP3 – LinkType 141

    • SCCP – LinkType 142

    • SDH – no registered identifier

    • SigComp – no registered identifier

    • V5’s envelope function – no registered identifier

    • X.25 – no registered identifier, above LAPB and XOT

    • XOT – TCP port 1998

  • Legacy application protocols:

    • ACAP – TCP port 674 (RFC 2244)

    • AgentX – TCP port 705 (RFC 2741)

    • BEEP – no registered identifier (RFC 3080, RFC 3081)

    • CMP over TCP – TCP port 829 (RFC 2510)

    • COPS – TCP port 3288 (RFC 2748)

    • DHCP failover – TCP port 647 (RFC 8156, and draft-ietf-dhc-failover-12 for DHCPv4)

    • Finger – TCP port 79 (RFC 1288)

    • Gopher – TCP port 70 (RFC 1436)

    • Handle System resolution, which DOI uses – TCP and UDP port 2641 (RFC 3652)

    • IAPP – UDP port 3517 (IEEE 802.11F)

    • ICAP – TCP port 1344 (RFC 3507)

    • ICP – UDP port 3130 (RFC 2186)

    • Kerberos version 4 – UDP port 750 (Project Athena’s Kerberos V4 specification)

    • KINK – TCP and UDP port 910 (RFC 4430)

    • LPD – TCP port 515 (RFC 1179)

    • RELOAD – no registered identifier (RFC 6940)

    • rexec – TCP port 512 (4.2BSD’s rexecd)

    • rlogin – TCP port 513 (RFC 1282)

    • rsh – TCP port 514 (4.2BSD’s rshd)

    • RSIP – TCP and UDP port 4555 (RFC 3103)

    • rwho – UDP port 513 (4.2BSD’s rwhod)

    • SASP – TCP port 3860 (RFC 4678)

    • SMUX – TCP port 199 (RFC 1227)

    • SPDY – no registered identifier (draft-mbelshe-httpbis-spdy-00)

    • TACACS – UDP port 49 (RFC 1492)

    • Time – TCP and UDP port 37 (RFC 868)

    • TSP – TCP and UDP port 3653 (RFC 5572)

    • Whois – TCP port 43 (RFC 3912)

    • X11 – TCP ports 6000 to 6063 (the X Window System Protocol)

    • XDMCP – UDP port 177 (the X Display Manager Control Protocol)

    • Z39.50 – TCP port 210 (ANSI/NISO Z39.50)

  • Legacy non-IP stacks:

    • AARP – EtherType 0x80F3

    • AFP over DSI – TCP port 548

    • AppleTalk’s DDP – EtherType 0x809B

    • Apple IP over FireWire – LinkType 138

    • Banyan VINES – EtherType 0x0BAD

    • CLNP – LLC SAP 0xFE and IP protocol 80

    • COTP – IP protocol 29

    • DEC LAT – EtherType 0x6004

    • DEC LANBridge spanning tree – EtherType 0x8038

    • DECnet Phase IV – EtherType 0x6003

    • DLSw – TCP ports 2065 and 2067

    • ES-IS – LLC SAP 0xFE

    • IBM RPL – LLC SAP 0xFC

    • IBM SNA – EtherType 0x80D5

    • IPX in UDP – UDP port 213

    • LocalTalk – LinkType 114

    • NetBEUI – LLC SAP 0xF0

    • NetWare’s NCP – TCP port 524

    • OSI over PPP – PPP protocols 0x0023 and 0x8023

    • XNS IDP – EtherType 0x0600

  • Medical:

    • DICOM – TCP ports 104 and 11112

    • HL7 over MLLP – TCP port 2575

  • Messaging:

    • AIM’s OSCAR – TCP port 5190

    • AMQP – TCP port 5672

    • Delivery Optimization – TCP port 7680

    • DirectPlay – TCP and UDP port 47624

    • Gnutella – TCP and UDP port 6346

    • IRC – TCP ports 194 and 6667

    • PTP/IP – TCP port 15740

  • Non-network buses and host interfaces:

    • D-Bus – LinkType 231

    • DisplayPort AUX – LinkType 275

    • DVB-CI – LinkType 235

    • ETW – LinkType 290

    • I2C – LinkType 209

    • IPMI’s HPM.2 – LinkType 260

    • ISO 14443 – LinkType 264

    • MA-USB – no registered identifier

    • MDB – LinkType 300

    • MUX27010 – LinkType 236

    • NC-SI – EtherType IEEE 0x88F8

    • SDLC – LinkType 268

    • USB – LinkTypes 186, 189, 220, 249, 266, 288 and 293 to 295

    • vsock – LinkType 271

  • PPP’s remaining protocols, beyond #2978:

    • BCP – PPP protocols 0x0031 and 0x8031 (RFC 3518)

    • CBCP – PPP protocol 0xC029 (draft-ietf-pppext-callback-cp-02)

    • Compressed datagrams – PPP protocol 0x00FD (RFC 1962)

    • IP header compression, CRTP included – the odd PPP protocols 0x0061 to 0x0069 and 0x2063 to 0x2069 (RFC 3544)

    • PPPMux – PPP protocols 0x0059 and 0x8059 (RFC 3153)

    • Van Jacobson compression – PPP protocols 0x002D and 0x002F (RFC 1144)

  • Storage and HPC fabrics:

    • 9P – TCP port 564

    • AFS’s Rx – UDP ports 7000 to 7009

    • ATA over Ethernet – EtherType IEEE 0x88A2

    • FCoE – EtherType IEEE 0x8906

    • FIP – EtherType IEEE 0x8914

    • Fibre Channel – LinkTypes 224 and 225

    • HyperSCSI – EtherType IEEE 0x889A

    • InfiniBand – LinkType 247

    • IP over Fibre Channel – LinkType 122

    • IPoIB – LinkType 242

    • iSNS – TCP port 3205

    • NBD – TCP port 10809

    • NDMP – TCP port 10000

    • NVMe/TCP – TCP port 4420

    • RoCE – EtherType IEEE 0x8915 and UDP port 4791

  • Tunnelling, routing and rarely seen L2 to L4:

    • AMT – UDP port 2268 (RFC 7450)

    • AYIYA – UDP port 5072 (draft-massar-v6ops-ayiya)

    • Babel – UDP port 6696 (RFC 8966)

    • BIER – EtherType IEEE 0xAB37, and above MPLS, with no UDP port (RFC 8296)

    • ForCES IFE – EtherType IEEE 0xED3E (RFC 8013)

    • IEEE 802.1BR’s E-Tag – EtherType IEEE 0x893F (IEEE 802.1BR)

    • IEEE 802.1Qbg’s ECP – EtherType 0x8940 (IEEE 802.1Qbg)

    • IEEE 802.21’s MIH – EtherType 0x8917 (IEEE 802.21)

    • IEEE 802a’s OUI-extended EtherType – EtherType 0x88B7 (IEEE 802a)

    • IEEE 1905.1 – EtherType IEEE 0x893A (IEEE 1905.1)

    • IPComp – IP protocol 108 (RFC 3173)

    • LISP – UDP ports 4341 and 4342 (RFC 9300, RFC 9301)

    • MSDP – TCP port 639 (RFC 3618)

    • PCEP – TCP port 4189 (RFC 5440)

    • PGM – IP protocol 113 (RFC 3208)

    • PSP – no registered identifier, as UDP port 1000 is IANA’s cadlock2 (Google’s PSP Architecture Specification)

    • SCTP over UDP – UDP port 9899 (RFC 6951)

    • TIPC – EtherType IEEE 0x88CA (the TIPC protocol specification)

    • TRILL – EtherType 0x22F3 (RFC 6325)

    • TRILL’s RBridge Channel – EtherType 0x8946 (RFC 7178)

    • WireGuard – no registered identifier, as UDP port 51820 is unassigned (the WireGuard whitepaper)

  • Windows security tokens and DCE/RPC interfaces, which SMB (#3121) keeps as octets:

    • DCOM – no registered identifier, a DCE/RPC interface (MS-DCOM)

    • DRSR – no registered identifier, a DCE/RPC interface (MS-DRSR)

    • EPM – the DCE/RPC interface at TCP and UDP port 135 (MS-RPCE)

    • GSS-API’s initial context token – no registered identifier, inside SMB, HTTP and others (RFC 2743)

    • MS-PAC – no registered identifier, inside Kerberos’s authorization data (MS-PAC)

    • NEGOEX – no registered identifier, inside SPNEGO (MS-NEGOEX)

    • NRPC – no registered identifier, a DCE/RPC interface (MS-NRPC)

    • NTLM – no registered identifier, a token inside SMB, HTTP and others (MS-NLMP)

    • SAMR – no registered identifier, a DCE/RPC interface (MS-SAMR)

    • SPNEGO – no registered identifier, a token inside SMB, HTTP and others (RFC 4178)

    • SRVSVC – no registered identifier, a DCE/RPC interface (MS-SRVS)

    • WKSSVC – no registered identifier, a DCE/RPC interface (MS-WKST)

PCAPNG Support

Done. The builtin default engine parses PCAP-NG files; PCAPNG implements the format, with its block and option enumerations under PCAPNG Constant Enumerations. This closes #35. PCAPNGIO writes the format, as the pcapng output of an extraction and of a flow tracer (#2835).

Maybe Even Faster?

Partly done. A measured benchmark exists, and acting on it cut extraction time on a 1117-frame HTTP capture by about 46% with byte-identical output. The profiling found these wrong on the hot path, none of them the ones the thread predicted:

  • character-set detection was uncached, and accounted for 30% of an HTTP extraction – 3011 chardet.detect() calls over 163 distinct bytestrings;

  • every field of every protocol was copied through the generic copy.copy() machinery, 63207 times per extraction;

  • Field.length recomputes struct.calcsize() on each read and was read two to four times per field;

  • Schema’s __setattr__ re-entered itself once per field assigned.

Predictions the profiling contradicted, recorded so nobody spends time on them again: Info construction – the usual suspect – is 0.0% of its own cost and 4.4% of a parse, and the logging integration is 0.03% even in the heaviest shape, since every call site is a lazy %s. The IO-batching idea the thread proposed was never the bottleneck.

The larger costs lie outside the parse path:

  • Done. A flow tracer keeps each flow’s output file open between its frames, up to TRACE_OPEN_FILE_LIMIT files, rather than reopening it for every frame in PCAPIO’s __call__ (#2815). Nor does the dumper rebuild a whole Frame to obtain bytes it already holds; dropping that re-dissection was about 82% of the cost of a flow-traced extraction by itself.

  • A datagram is submitted for every frame, fragmented or not, because ipv4_reassembly() filters only on the DF flag – so a capture with no fragments at all still produces one “datagram” per frame. Parsing its payload is not part of that cost: Datagram.packet is a Deferred parsed on first read, rather than running analyze() eagerly on each one, measured at 86% of the IP-reassembly cost plus a 133 ms garbage-collection bill. Whether unfragmented frames should be emitted at all is the design question that is left, and #2961 asks for that ruling.

  • Done. OptionField reads only the base schema’s type field to choose the option schema, rather than unpacking the whole base schema and throwing it away. Unpacking it parsed every option twice – 2274 schema unpacks for 1137 options, the pre-parse always discarded, about 15% of a PCAP-NG extraction.

A trap for anyone benchmarking this library: timing several capture shapes in one process inflates them by up to 73%, so each shape wants its own interpreter.

Recursive Dissection, With a Depth Limit

Decided, open to revisit. Each layer dissects the next from inside its own parse, so dissecting a frame recurses once per layer, at 9 to 12 Python frames a layer. Without a bound, deep nesting – IP in IP, stacked 802.1Q tags, long chains of IPv6 extension headers – exhausts the recursion limit and leaves the rest of the frame raw, silently, at a depth that varies with the interpreter and the caller’s stack (#1604, #1610).

Recursion stays, with a counted bound: FRAME_LAYER_LIMIT caps a frame at 64 layers by default, and EXTENSION_HEADER_LIMIT caps one chain of extension headers at 32 by default. Past either, the rest stays Raw, with one ProtocolWarning. Raising sys.setrecursionlimit() instead was rejected: it is process-wide, and the cut-off would still move with the caller’s stack. The bound fits with room to spare, but not unlimited room. Under pytest at the default limit of 1,000, the costliest 64-layer frame needs a limit of 834 on Python 3.11 and 756 on 3.14. That frame is IPv4 carrying a chain of 32 extension headers, then IPv4 in IPv4 carrying 28 more, then TCP.

An iterative model would need no such bound: a loop that dissects one layer and takes the next from it. It changes how every protocol hands over its payload, so it is a design of its own, and it ships alone in a major release, as ruled on #2805. Its issue is not filed yet.

Logging Integration

Done. pcapkit.utilities.logging provides:

  • a logger hierarchy rooted at pcapkit, with every module logging through its own child obtained from get_logger(), so that a subtree such as pcapkit.foundation.registry can be silenced independently of pcapkit.foundation.extraction;

  • library-safe defaults – importing pcapkit attaches only a logging.NullHandler and sets no level, leaving the destination and verbosity to the application. PCAPKIT_DEVMODE bootstraps a sys.stderr handler at logging.DEBUG;

  • a runtime configuration API – configure(), reset() and ensure_output() – rather than a single environment variable read once at import;

  • levels chosen deliberately. Registration bookkeeping across pcapkit.foundation.registry logs at debug rather than info, since a library announcing its own registry entries is not news to its consumer;

  • debug coverage of the extraction path – extractor construction, engine selection and fallback, frame counts, cleanup, reassembly and flow-tracing setup – so that DEBUG explains what PyPCAPKit did with a file without descending into per-field parsing.

See Logging System for the configuration recipes, including the one-line restore of sys.stderr output.

New Engines

Done, for both candidates. engine='pypcapfile' selects pcapkit.foundation.engines.pypcapfile.PyPCAPFile and engine='pypcap' selects pcapkit.foundation.engines.pypcap.PyPCAP; each has a matching pcapkit.toolkit module (pcapkit.toolkit.pypcapfile, pcapkit.toolkit.pypcap), a pyproject.toml extra (PyPCAPFile and PyPCAP, neither of which all includes – all carries core addons only, and PyPCAP also has the installability problem below), docs under Engine Support, and tests under tests/foundation/engines/ and tests/toolkit/. Like every third-party engine, both are best effort: they need not match the default engine, and protocol rules belong in the default engine only (#1687).

Neither library, though, is usable straight from PyPI on a current Python, and both of the following are worth knowing before reaching for them:

  • pypcapfile – the released 0.12.0 imports the imp module, removed in Python 3.12. Precisely, pcapfile/linklayer.py imports it at module scope and pcapfile.savefile imports linklayer, so while a bare import pcapfile still succeeds on 3.12+, the modules the engine actually needs raise ModuleNotFoundError. Upstream master (0.12.1, unreleased) has fixed this, and that is what the engine was verified against. The extra therefore installs a version that does not work on Python 3.12 or newer until 0.12.1 is published.

  • pypcap – the 1.3.0 sdist (the only distribution; there has been no wheel since Python 2.7) ships a pcap.c pre-generated by Cython 0.29.32 and compiles it verbatim – its setup.py never invokes Cython. That generated C does not compile against the Python 3.12+ C API, and the cause is three independent CPython removals rather than one: ob_digit and PyThreadState.curexc_traceback went in 3.12, _PyLong_AsByteArray gained a sixth parameter in 3.13, and PyDictObject.ma_version_tag went in 3.14. The ceiling is therefore Python 3.11, measured: given libpcap, the shipped pcap.c builds unchanged on 3.10 and 3.11 and fails on 3.12 and 3.14. Regenerating it needs Cython 3.0+ – no 0.29.x release, including the last, emits 3.12-compatible C.

    Separately, its setup.py consults neither CFLAGS/LDFLAGS nor pkg-config; it searches a fixed prefix list (/usr, sys.prefix, /opt/libpcap*, ../libpcap*, ../wpdpack*, the macOS SDKs). /opt/homebrew is absent from that list, and Homebrew’s libpcap is keg_only :provided_by_macos so it is never symlinked into a searched prefix either – meaning brew install libpcap on the arm64 macOS runners would not have fixed the original failure, on either count. It builds once libpcap is visible under sys.prefix and the interpreter is 3.11 or older.

    That is a packaging problem upstream rather than an engine problem – and upstream is unmaintained, with no code commit since the 1.3.0 release and its Python 3.12 issue (pynetwork/pypcap#116) open and uncommented since May 2024. It does mean pip install pypcapkit[PyPCAP] can fail to build. Since there is no wheel to fall back on, the extra is kept out of all: otherwise pip install pypcapkit[all] would demand a compiler and the libpcap development files from every user, and would break the docs build, which installs .[all,dev] on the macOS runner, where pcap.h is present but no libpcap.dylib is.

    That is solved, though not by changing the PyPCAP extra. pcap-ct re-implements the pypcap API in pure Python over ctypes, and it is wired up as a separate engine, PCAP_CT, selected with engine='pcap_ct' and installed with pip install pypcapkit[PCAP_CT]. It works on every supported interpreter, verified on 3.10 and 3.14.

    A separate engine rather than a second backend because the two are mutually exclusive: both distributions own the import name pcap, and with both installed pcap-ct wins the import while upstream’s extension module is shadowed and unreachable. Each engine detects which backend it actually got and says so, rather than one engine= string silently meaning two different implementations.

    Caveats remain. Both distributions are still beta releases, and pcap-ct targets the pypcap 1.2.3 API – within what this engine uses, but worth knowing. And despite the libpcap wheel bundling prebuilt binaries, a runtime libpcap shared library is still required: that wheel’s published configuration sets LIBPCAP = None, which sends the loader to find_library("pcap"). No compiler and no pcap.h are needed; a libpcap.so.1 is.

Both engines support less than the default engine does, deliberately: pypcap performs no protocol dissection, so it disables reassembly and flow tracing; pypcapfile has no IPv6 decoder, so it disables IPv6 reassembly while keeping IPv4 and TCP, and it disables DTLS reassembly, which reads pcapkit’s own DTLS layer. Each gap is announced through an AttributeWarning or an outright exception rather than by silently returning nothing, save that pypcapfile leaves TCP behind a VLAN tag, in a tunnel or behind an extension header (an IPv6 one, or AH in IPv4) out of TCP reassembly and flow tracing without a warning – Engine Support tabulates them, and Not Planned gives each gap’s issue.

Adding a further engine does not mean adding handler methods to Extractor, as the thread describes. A new engine subclasses pcapkit.foundation.engines.engine.Engine and implements just run() and read_frame(); passing the engine class keyword registers it. See Customisation & Extensions for a worked example. What does still apply is the unified auxiliary tools in pcapkit.toolkit, where each engine has a matching module.

Test Cases

Largely done. There is a systematic test suite under tests/, and it runs in CI against Python 3.11 through 3.15, per .github/workflows/unit-tests.yml, and against the end-of-life 3.8 through 3.10 on legs whose failures block nothing. The module count is measurable:

find tests -name 'test_*.py' | wc -l

The suite is split by what a test needs rather than by what it covers, and tests/_tiers.py enforces the split. The unit tier may read only captures committed to the repository; the fixture-dependent tier – which is tests/integration/ together with every *_runtime.py and *_regression.py module – may also read the generated sample captures. Those samples are not tracked in git, so examples/generators/make_samples.py (make samples) rebuilds them from source, and the tier guard raises rather than letting a unit-tier module quietly depend on a file that may not exist.

What remains wanted is coverage rather than infrastructure: the protocols and the registered-but-unhandled type codes listed above have no tests because they have no implementation yet. Pinning what each of them reaches today, so that a test fails as one gains a handler, is #3008.

The original ask also included shipping the suite. tests is excluded from the wheel by [tool.setuptools.packages.find] in pyproject.toml; the sdist does carry every module, so a distribution packager building from source has them. Nor could the suite run from an installed package: the generated sample captures are not shipped, and tests/_tiers.py resolves paths from a repository root that an installed package does not have. Shipping it in the wheel, runnable from an install, is #3022, as the owner ruled on #2805.

Note

dictdumper’s PLIST writer formats every datetime as '%Y-%m-%dT%H:%M:%S.%fZ', always with six fractional digits, and plistlib’s <date> pattern admits none, so without the workaround below plistlib.load() fails on every format='plist' report with AttributeError: 'NoneType' object has no attribute 'groupdict'. The upstream defect is JarryShaw/DictDumper#122. pcapkit.dumpkit.common.make_dumper() works around it (#1448): it writes each date in UTC to whole seconds, as plistlib.dump() does. The exact value stays in the sibling field every timestamp already has, such as time_epoch. PlistRoundTripTests.test_plist_report_round_trips_through_plistlib, in tests/integration/test_output_formats.py, checks the round trip.

Reassembly Beyond IP and TCP

Still open. Packets Reassembly covers IPv4, IPv6, TCP and DTLS handshake messages (see DTLS above), and no more. IPv4 and IPv6 share the RFC 791 procedure, except that a fragment overlapping another abandons an IPv6 datagram, as RFC 8200 Section 4.5 requires, where IPv4 overwrites the octets it overlaps (#2547). TCP uses the RFC 815 hole-descriptor algorithm, which does handle out-of-order and overlapping segments. SCTP has nothing: a user message split across DATA or I-DATA chunks is never put back together, and pcapkit.foundation.reassembly has no SCTP reassembler (#2935).

What that costs is concrete. The dissector already exposes everything a reassembler needs, on DATAChunk – tsn, stream_id, stream_seq, ppid, data, and flags.B and flags.E for the beginning and ending fragment bits – and on IDATAChunk, whose mid and fsn exist to make interleaved reassembly tractable (#2811). The dispatch reads none of the fragment fields: a packet’s first DATA or I-DATA chunk is dispatched on its PPID as though it were a whole PDU, so a registered upper layer can be handed part of a message. Only that chunk of a bundle is dispatched at all; dispatching every whole message is #2993.

The reassembler would be a package at pcapkit/foundation/reassembly/sctp/, whose class subclasses Reassembly and implements reassembly() and submit(). The wiring already takes it: a reassembler registered in Extractor.__reassembly__ is enabled by name, made by make_reassembly(), held by ReassemblyManager and fed through each engine’s adapter in EngineBase.__reassembly__, so a further protocol costs one class plus one adapter per engine (#2814).

Smaller items in the same subsystem:

  • Flow tracing is TCP only, because TCP’s is the only tracer Extractor.__traceflow__ registers. Any registered tracer named in traceflow is made and fed, through each engine’s adapter in EngineBase.__traceflow__, and TraceFlowManager holds the enabled tracers by name (#2843). Tracers for UDP, SCTP and IP conversations are #2956.

    It does treat both directions of a connection as one flow, though. TCP.make_bufid orders the two endpoints canonically, so both halves of a conversation reduce to one buffer ID, one label and one output file, and Index reports forward and reverse alongside index so per-direction ordering stays recoverable. This is the default; bidirectional=False, on TraceFlow or in the TraceFlowOptions that Extractor, extract() and follow_tcp_stream() take as traceflow, selects per-direction flows instead.

    What ends a bidirectional flow is worth stating, because the obvious answer is wrong. A teardown – a FIN from each endpoint, or a RST from either – is recorded but does not finalise the flow: the four-way close of RFC 9293 Section 3.6 is FIN, ACK, FIN, ACK, so the final acknowledgement arrives after the second FIN, and finalising on that FIN drops the ACK from the flow and lets it open a fresh buffer under the same canonical buffer ID – which a later connection reusing those endpoints then merges into. Duplicates of that ACK defeat any rule that tries to name the last packet of the exchange. So the flow is finalised only by proof that nothing more can arrive: a new connection’s SYN on the same endpoints, or the end of the capture, via TraceFlow.finish. Distinguishing that SYN from the peer’s SYN-ACK is what the recorded teardown is for.

    One case remains undecided rather than solved: a capture that starts in the middle of a connection, sees no teardown, and then has its endpoints reused. The reuse is indistinguishable from a continuation without the ACK flag, which Packet does not carry as a field. Reading it, in a rule that also survives a simultaneous open (RFC 9293 Section 3.5) and a retransmitted SYN, is #2962.

    The application layer is wired into flow tracing as well. Of the ways of buffering a traced payload, the tracer delegates to TCP rather than growing a per-direction payload buffer of its own. A buffer that concatenated payloads in capture order would be silently wrong on the first retransmission or reordered segment, where the RFC 815 hole-descriptor algorithm already in the reassembler is not – so Packet carries the segment fields (seq, ack, header, payload) that reassembler needs, and the tracer hands each traced segment straight to it.

    Index.packet then holds the reassembled datagrams, one per direction and acknowledgement number (TCP says why), and postpones twice: reading it is what flushes the flow’s reassembler, and each datagram’s own packet is parsed later still, through the same Deferred arrangement the reassembly side uses. It is opt-in – analyze=True, on TraceFlow or in TraceFlowOptions – because buffering every traced payload is a cost tracing does not otherwise pay, and tracing’s per-packet cost is something this package has deliberately driven down. It is unavailable on the pyshark engine, which reports dissected fields rather than the octets behind them, and which for the same reason has no reassembly adapter at all; asking for it there warns and falls back.

  • Timing a partial datagram out is implemented. Reassembly.expire abandons a buffer whose first-arriving fragment is older than timeout seconds, and the buffer models carry the timestamp that makes it possible.

    The clock is the capture’s own timestamps, not the host’s: an offline parser has no other notion of time passing, and keying on time.time() would make the same file reassemble differently on every run. An extraction advances every enabled reassembler to each frame’s timestamp through Reassembly.advance before feeding it the frame (#2814), so a stalled buffer is reported as TIMEOUT once any later frame passes its deadline, whatever that frame’s protocol. A reassembler fed by hand sees only the packets handed to it, so a buffer none follows is reported as PARTIAL at the end of the capture.

    On the numbers: the 15 seconds RFC 791 names is that RFC’s initial timer setting, a lower bound which TIMER <- MAX(TIMER,TTL) then raises toward the 4.25-minute TTL ceiling – not a deadline. RFC 1122 Section 3.3.2 supersedes the scheme outright (“The reassembly timeout value SHOULD be a fixed value, not set from the remaining TTL… between 60 seconds and 120 seconds”), so IPv4 uses 60 seconds, agreeing with the 60 RFC 8200 Section 4.5 mandates for IPv6. TCP and DTLS are left with no timeout at all, since no specification gives their reassembly a deadline, and an idle TCP connection is ordinary rather than pathological; timeout enables one on request.

    The memory motive is narrowed rather than removed: an in-flight IP datagram identifier still holds a fixed 72 KiB of preallocated space, but for at most the timeout’s worth of capture time rather than for the life of the Extractor. Sizing each buffer to the fragments it holds is #2957. RFC 8200 Section 4.5 and RFC 1122 Section 3.3.2 also want an ICMP Time Exceeded sent on expiry when the offset-zero fragment has been received; a parser sends nothing, so the condition is only reported in the log record.

Reassembly is also unavailable on some engines rather than merely slower, which is worth knowing before benchmarking against them: pyshark, pypcap and pcap_ct disable it entirely, pypcapfile disables IPv6 and DTLS reassembly, and the dpkt and scapy engines disable DTLS reassembly. Engine Support tabulates that.

Checksum and Integrity Verification

Partly done. The one’s-complement checksums are done, and CALIPSO’s CRC-16 is #2970; of the cryptographic half, ESP’s is done and AH’s (#2965) and HIP’s (#2939) are open.

These protocols parse a checksum or CRC field — GRE, HIP, HOPOPT, ICMPv4, ICMPv6, IGMP, IPv4, IPv6_Opts, IPX, MH, OSPF, DCCP, SCTP, TCP and UDP — and SCTP checks whether the value is right, through SCTP.checksum_valid. IPv4, OSPF, TCP, UDP and DCCP check it too, as do ICMP, ICMPv6, IGMP, GRE, MH and HIP, as the one’s-complement half below describes. The rest record the field and never question it, so a corrupted capture parses as cleanly as an intact one:

These are different problems and they want separating, because only one of them is cryptographic and the distinction decides what is actually hard.

The one’s-complement Internet checksum, which covers IPv4’s header, TCP, UDP, DCCP, ICMP/ICMPv6, IGMP, GRE, OSPF, MH and HIP, needs no cryptography: it is sixteen-bit addition with end-around carry. The hard part is the IP pseudo-header: the TCP, UDP, DCCP, ICMPv6, MH and HIP checksums cover source and destination addresses, the protocol number and the payload length, all of which live in the enclosing layer, so verification is a structural question about Protocol rather than an arithmetic one. SCTP has no such dependency: RFC 9260 Section 6.8 defines its CRC32c over the common header and chunks with the checksum field zeroed and no pseudo-header, so the SCTP packet alone verifies it. Its CRC32c is a hand-rolled lookup table in pcapkit.protocols.transport.sctp.protocol, not a library call, so it is no precedent for a dependency either.

The cryptographic integrity checks are where the cryptography dependency — introduced for ESP — genuinely buys something new, and half of that is already done. ESP already verifies its ICV when a Security Association is supplied, and deliberately reports a failure rather than raising, so a forged packet still parses and says so. What is not done is HIP: its HIP_MAC, HIP_MAC_2, RVS_HMAC and RELAY_HMAC parameters, and its HIP_SIGNATURE and HIP_SIGNATURE_2 parameters, are parsed into their data models and never checked against the packet (#2939). Verifying them needs a keying context in the shape ESP already established through pcapkit.corekit.context, which is the reusable part of the design rather than something to invent. Nor is AH’s ICV checked: it is parsed as octets, and verifying it needs that keying context plus the enclosing IP header, whose immutable fields it covers (RFC 4302 Section 3.3.3), which is #2965.

The policy questions this raised have all been settled by the repo owner, and each lands on a precedent the library already has:

  • Verification is opt-in. Checksumming every packet costs real time on a large capture, and Maybe Even Faster? above is a standing concern, so it is a flag rather than unconditional behaviour.

  • A wrong checksum is a warning, not a hard failure, and the outcome is recorded on the protocol class. The warning is a ChecksumWarning, a ProtocolWarning of its own so a filter can silence it alone (#2470), and the recording has an exact precedent in ESPStatus: an enumeration of outcomes carried on the parsed result, so a caller can ask after the fact rather than having to have been capturing warnings at the time. That distinction matters — a warning is for the human watching, and the recorded status is for the program. Note ESP’s enum also has a member for “the expected state for a capture taken without keys, and is not an error”, which is the shape the offload case below wants.

  • The IP pseudo-header gets a pseudo-protocol class. Rather than giving a parsed protocol a back-reference to its parent, the pseudo-header becomes a first-class thing in its own right, defined once for the IP family and used by both the parsing and the constructing path. That is the better answer: a back-reference only helps verification, while a pseudo-header class is also what the construction side needs in order to emit a correct checksum, and the two paths then share one definition instead of agreeing by coincidence.

Checksum offload was left to implementation, being about wording rather than design. A capture taken on the sending host routinely holds checksums the NIC had not computed, zero or garbage on the wire, so the status has to say not computed distinctly from wrong, or it cries wolf on the commonest capture there is. It is NOT_COMPUTED below, spelled after ESPStatus’s NO_SA.

The one’s-complement half is done for every protocol whose checksum is one’s-complement (#2470, #2472 to #2475, #2489, #2618, #2813), on IP_Pseudo (#2471) and pcapkit.corekit.checksum.internet, settled as below: the toggles by the owner on #2471, the rest at implementation, as the offload question above asked; the owner accepted the toggles and the offload heuristic on #2470.

  • Every checksum path is togglable, and verifying and computing default apart. Parsing verifies only under PCAPKIT_CHECKSUM_VERIFY, off by default; construction computes a checksum the caller leaves out unless PCAPKIT_CHECKSUM_COMPUTE turns it off.

  • The toggle is an environment variable, with a per-call override only where a caller needs one. A checksum given to make() is written as given, which is what keeps a rebuild byte for byte; there is no Extractor or per-instance parameter.

  • The IP layer owns the pseudo-header. IPv4 and IPv6 verify their upper layer’s checksum once parsed, and compute it for an upper layer constructed as their payload; make() of TCP, UDP, ICMPv6, MH and HIP also takes the pseudo itself. MH’s checksum is defined over IPv6 alone, so over IPv4 it is NO_PSEUDO_HEADER.

  • Offload is NOT_COMPUTED, modelled on NO_SA: a zero IPv4 or TCP checksum, or a TCP or UDP one holding the pseudo-header’s sum alone, as Linux offload leaves it, never warns. So does a zero UDP checksum over IPv4 (RFC 768), but not over IPv6, where it is mandatory (RFC 8200 Section 8.1).

  • A fragment is NO_PSEUDO_HEADER, atomic ones aside: TCP, UDP, ICMP, ICMPv6 and IGMP checksums cover all of the datagram’s data, which it carries part of. OSPF’s Packet Length says what its checksum covers, so it is verified when the fragment holds that much, and TRUNCATED otherwise.

  • IGMP covers the whole IP payload in every version, and GRE its header and payload only when C is set (RFC 2236 Section 2.5, RFC 3376 Section 4.1.2, RFC 2784 Section 2.5). The IGMPv1 rule follows RFC 2236, which updates RFC 1112’s 8-octet one. A GRE header with C clear is NOT_COMPUTED, and make() computes one when checksum_present asks without giving it (#2618). Neither GRE nor the Linux cooked-capture header carries a length, so a GRE message the capture cut short there is TRUNCATED by the original length its PCAP record or PCAP-NG packet block states (#2653); behind IPv4 or IPv6, by the payload length they state (#2649). An IPv4 Total Length of 0 states none, so behind one, and through an AH after it, GRE, ICMP and IGMP go by the original length as well (#2689). A GRE or IGMP header the data ends inside is TRUNCATED too (#2689). Each of these cuts is recorded on the message’s own header, so the message rebuilt on its own reads TRUNCATED as well, an ICMP one included (#2711).

  • DCCP covers what its Checksum Coverage gives (RFC 4340 Section 9.2), over a pseudo-header that carries the whole packet’s length, as TCP’s does, so a fragment is NO_PSEUDO_HEADER too. A coverage running past the packet, which the RFC forbids and has the receiver ignore, is INVALID and warns. Linux, until it dropped DCCP in 6.16, never sent one: its dccp_csum_outgoing wrote a CsCov of 0 wherever the coverage reached the end of the packet, and make() does the same when it computes the checksum. No value is NOT_COMPUTED: DCCP has no checksum to leave out, and Linux computed it in software rather than offloading it. Settled at implementation (#2489).

Deterministic Construction Arguments

Done in 1.6.0 (#2594): a make() call’s argument list is deterministic.

Done in 1.8.0 (#2840): a protocol parses with from_file() and builds with from_fields(), each taking a closed keyword set (Public Signatures), and calling the class does either (#3081).

Further proposals for the construction workflow go under this heading.

Inferring a namespace from the caller’s frame, for a conventional four-argument group – X, X_default, X_namespace and X_reversed – leaves a call’s contract invisible from its signature: knowing what a bare string resolves against means knowing the convention and trusting that every call site follows it exactly. #2356 and #2394 are that inference failing, the first because an argument’s own default is None, leaving nothing to anchor a namespace to, the second because the name is a loop variable over a list parameter, which an isinstance(value, str) check on the arguments cannot see. Naming the enum at each affected call site fixes an instance and leaves the mechanism as fragile as it is.

So no make() infers a member from a string, ruled in review of #2593 (#2489): a field holding an enumeration takes the member or an int, resolved with the enumeration’s get(). That settles a call’s contract at the signature, the way info_final() and schema_final() settle a constructor’s keyword set once at class-definition time, and __own_make_keywords__ (#2286) which keywords a make() override owns. The pieces:

  • _make_index() takes the value, the enumeration and the field’s width, and returns what get resolves. A name, a bool for a field wider than one bit, and a code the field cannot carry raise ProtocolError, so every caller gets the range check #2617 asks for, with no masking. An option, a sub-option or a chunk given as a (code, arguments) pair resolves its code the same way.

  • The X_default, X_namespace and X_reversed keywords are removed in 1.6.0 with no deprecation period and no shim, ruled on #2594; each class that shipped them records them under versionremoved.

  • The public wrapper is Protocol.resolve_index, which takes the group explicitly – name, default, namespace, reversed – so a caller holding a bare string resolves it first and passes the result to make(). It is a static method every protocol inherits, beside decode() and unquote(), rather than a module of its own, since it serves make() alone.

The trade-off: the docs and the examples relied on a bare string for these fields, so the change breaks every make() call site that relies on the inference. That is why it is one change across pcapkit/protocols/: it removes the root cause of the #2356/#2394 family rather than leaving its next instance to be found and patched.

Not Planned

Asked for, and closed as wontfix for the reason given.

Skipped by the owner on #2805:

  • #3023 – DSL: a physical layer with no frame format of its own; a DSL capture carries PPPoE, which is dissected, or ATM AAL5.

  • #3024 – ISDN: no single wire format, Q.921 LAPD and then Q.931’s information elements, and no capture to test against.

No format to decode, so each stays generic or Raw:

  • #3025 – IPX’s checksum: no document defines the algorithm, and the field reads 0xFFFF, not used, in practice.

  • #3026 – PCAP-NG’s vendor block types: IRIG Timestamp and ARINC 429 are registered without a format, and Hone’s and Sysdig’s are defined only in those projects’ sources.

  • #3041 – the IPv4 options ZSU, FINN, IMITD, ENCODE, VISA and DPS, and the RFC 4727 experiments: none has a public option layout.

  • #3042 – the TCP options Skeeter, Bubba, Trailer Checksum, SNAP and TCP Compression Filter: registered to people, with no document.

  • #3043 – IPv6 routing type 1, Nimrod: IANA cites no document, and Nimrod’s specification defines no routing-header layout.

  • #3044 – ICMPv4 types 6 and 32: RFC 6918 records no public information on type 6, and type 32’s only reference is a work in progress no archive holds.

  • #3045 – the SCTP PPIDs whose registration names no document, or only a project’s sources or a site that does not resolve; register_sctp() serves a user who has a definition.

  • #3046 – the Echo, Discard, Daytime and Character Generator PPIDs: their RFCs carry arbitrary octets, so Raw is already the complete reading.

Reassembly behaviour kept as it is:

  • #3027 – a default TCP reassembly timeout: no RFC sets one, a default would be invented and would split long-lived idle streams, and timeout enables one on request.

  • #3028 – sending the ICMP Time Exceeded an expired IP buffer owes: an offline parser has nothing to send it on, so the buffer is released as TIMEOUT and the owed message is logged at debug.

Third-party engine gaps: those engines are best effort (#1687), and each of these gaps is structural, as the engine does not hand over what pcapkit’s reassemblers and tracers read:

  • #3029 – reassembly on PyShark without a registered adapter: tshark reports dissected fields rather than octets.

  • #3030 – analyze on PyShark: it reads each flow’s octets, which tshark does not hand over.

  • #3031 – reassembly and flow tracing on PyPCAP: pypcap does no dissection.

  • #3032 – reassembly and flow tracing on PCAP_CT: pcap-ct exposes pypcap’s interface, so it has the same gap.

  • #3033 – IPv6 reassembly on PyPCAPFile: pypcapfile has no IPv6 decoder.

  • #3034 – TCP over IPv6, behind a VLAN tag, in a tunnel or behind an extension header, on PyPCAPFile: pypcapfile decodes none of these carriers.

  • #3035 – tunnelled and extension-header traffic on DPKT: dpkt does not decode those chains, and walking them in the adapter was reverted under #1687.

  • #3036 – the frames DPKT cannot decode: they are kept raw, so there is nothing to reassemble or trace.

  • #3037 – IPv6 past what Scapy dissects: scapy stops behind AH, Mobility, HIP and Shim6, and binds a BSD loopback family per host.

  • #3038 – DTLS reassembly on DPKT: it reads pcapkit’s own DTLS layer, which dpkt never produces.

  • #3039 – DTLS reassembly on Scapy: likewise, as scapy never produces that layer.

  • #3040 – DTLS reassembly on PyPCAPFile: likewise, as pypcapfile never produces that layer.

Remaining Work

The open work above, each item with its issue. Nothing here is claimed: to take an item, say so on its issue.

Per-entry coverage of the option and parameter registries. The option, parameter, block and frame registries are enumerated but not implemented throughout: a code can be registered and named, and still have no per-entry read/make pair behind it. The goal is to close that gap for every code whose format is specified, and Not Planned lists the codes without one. The planned ones:

  • TLS extensions (#2966), PPP’s control protocols (#2978), and the MPLS label stack behind PPP and Ethernet (#3013);

  • ICMPv4 message types (#2983), and ICMPv6’s beyond Neighbor Discovery (#2986) with RPL (#2991);

  • IPv4 options (#2997), IPv6 options (#2996) and routing types (#2984), and HIP’s parameters (#3006);

  • TCP options (#2987), DCCP options (#2999) and SCTP’s chunk codes (#2989);

  • DNS RR types and EDNS options (#3002), and HTTP/2 frame types (#3003).

Both halves of the gap are measurable, against the families examples/generators/options.py walks and the EXPECTED_FAILURES of tests/protocols/test_option_roundtrip_unit.py:

# registered codes, and the families they are drawn from
python -c "import sys; sys.path.insert(0, 'examples/generators'); import options; \
           print(len(options.cases()), len(options.FAMILIES))"

# codes that do not round-trip, grouped by family
python -c "import collections, importlib.util, sys; \
           spec = importlib.util.spec_from_file_location('rt', \
               'tests/protocols/test_option_roundtrip_unit.py'); \
           m = importlib.util.module_from_spec(spec); sys.modules['rt'] = m; \
           spec.loader.exec_module(m); \
           print(collections.Counter(k.split('/')[0] for k in m.EXPECTED_FAILURES))"

Two things to be precise about. The round-trip half is closed: EXPECTED_FAILURES is empty, so a new entry there records a defect rather than a deferral. And round-tripping is not the same as being implemented: the harness walks the codes each protocol registers a handler for, not every code its enumeration names, so what remains is the codes with no per-entry handler, such as the SCTP chunk types under SCTP above, which parse as opaque.

This is deliberately not the same request as the __proto__ dispatch registries. Those name whole protocols, so closing a gap there means writing a dissector, which is the protocol work above. The option and parameter registries are per-entry formats inside protocols that already exist, so the work is self-contained. Their harness already fails when a registered code has no case; what is missing is the implementations behind the codes, not the accounting of them. tests/protocols/test_dispatch_registry_unit.py gives the __proto__ family the same accounting for whether a registered protocol’s dispatch reaches it.