Skip to content

pmd-pytcp 0.3.0

Choose a tag to compare

@doronz88 doronz88 released this 22 Jul 07:31
· 31 commits to main since this release
d66d76f

Highlights

  • Software RX checksum offload — new net.rx_cksum_validate sysctl (interface-scope, default True). 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 knob False on 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 --userspace tunnel (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 the errno module, whose values differ on macOS (49/48/61/60/39). Now asserted via the errno constants. One raise site (pick_local_port) hardcoded a Linux errno into its message instead of OSError(errno.EADDRINUSE, …) — fixed to the canonical form (which also sets .errno).
    • Strict IPv4 parsing independent of libcIp4Address/Ip4Mask/Ip4Wildcard trusted socket.inet_pton(AF_INET, …) to be strict, but Darwin's accepts inet_aton leniencies (leading-zero octets like 1.2.3.010). Parse canonical dotted-decimal in-package instead — same grammar as glibc on every platform, leading-zeros rejected per the ipaddress/CVE-2021-29921 precedent.
    • PLPMTUD honours a sub-BASE_PLPMTU operator seedPmtuSearch floored plpmtu_seed at BASE_PLPMTU (1200/1280), starting a small operator tcp.base_mss above its declared-safe size. Floored at the family minimum link MTU instead (Linux tcp_base_mss semantics).

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.