pmd-pytcp 0.3.0
Highlights
-
Software RX checksum offload — new
net.rx_cksum_validatesysctl (interface-scope, defaultTrue). The RFC 1071 TCP/UDP checksum pass is the single most expensive step of per-packet parsing (~15–20% of stack CPU on a bulk transfer). Set the knobFalseon an interface whose link already guarantees payload integrity — e.g. packets arriving over an AEAD-authenticated tunnel through an in-memory fd — and the RX handlers skip only the checksum arithmetic. Everything else stays active: every structural integrity check, the RFC 8200 §8.1 UDP zero-checksum drop policy, and all TX checksum generation (the peer still verifies what you send). The software analogue of a NIC's RX checksum offload (ethtool -K <iface> rx off). Measured through pymobiledevice3's--userspacetunnel (the motivating consumer): download 73 → 99 MB/s (+35%), byte-identical payload. -
16 pre-existing macOS test failures fixed. CI ran a Linux-only subset, so these were invisible; the full suite (all packages, every test) is now 12508 passed, 0 failed on macOS/Linux alike.
- Platform-correct errno — 10 socket tests asserted Linux errno literals (
[Errno 99],[Errno 98], …) against messages the stack builds from theerrnomodule, whose values differ on macOS (49/48/61/60/39). Now asserted via theerrnoconstants. One raise site (pick_local_port) hardcoded a Linux errno into its message instead ofOSError(errno.EADDRINUSE, …)— fixed to the canonical form (which also sets.errno). - Strict IPv4 parsing independent of libc —
Ip4Address/Ip4Mask/Ip4Wildcardtrustedsocket.inet_pton(AF_INET, …)to be strict, but Darwin's acceptsinet_atonleniencies (leading-zero octets like1.2.3.010). Parse canonical dotted-decimal in-package instead — same grammar as glibc on every platform, leading-zeros rejected per theipaddress/CVE-2021-29921 precedent. - PLPMTUD honours a sub-BASE_PLPMTU operator seed —
PmtuSearchflooredplpmtu_seedat BASE_PLPMTU (1200/1280), starting a small operatortcp.base_mssabove its declared-safe size. Floored at the family minimum link MTU instead (Linuxtcp_base_msssemantics).
- Platform-correct errno — 10 socket tests asserted Linux errno literals (
Defaults are unchanged: RX checksum validation stays on for every interface unless a consumer opts out per interface.
Coordinated version bump across the three packages the feature spans: pmd-pytcp 0.3.0, pmd-net-proto 0.0.3, pmd-net-addr 0.0.3.