Skip to content

Releases: ccie18643/PyTCP

PyTCP 3.0.8

Choose a tag to compare

@ccie18643 ccie18643 released this 24 Jul 01:38

3.0.8 — 2026-07-23

The daemon-backed userspace. 3.0.7 split the stack into a daemon that
owns the interface and a thin client boundary; 3.0.8 builds the
user-facing layers on top: off-the-shelf Python network programs run
unmodified against a running daemon through a 1:1 stdlib-socket
drop-in, a full pytcp CLI multitool operates the stack, and a
stack-internal loopback interface lets one daemon talk to itself.

Daemon mode is now the official, supported way to run the stack.
Boot it with sudo pytcp stack start -i tap7 (autoconfigures via
DHCPv4) or python -m pytcp.daemon for a static address. In-process
embedding still works but is explicitly unsupported.

Added

  • Drop-in stdlib-socket replacement. from pytcp import socket
    returns real, selectors-pollable descriptors backed by the daemon
    over its AF_UNIX control boundary. Blocking programs and asyncio
    servers/clients run unchanged — including non-blocking
    connect / accept, getpeername / ENOTCONN parity, SO_ERROR,
    honored SO_RCVBUF, sendmsg with IP_TOS / IPV6_TCLASS cmsg,
    and survival across a sys.modules['socket'] swap.

  • pytcp CLI multitool — one command over the daemon: ping,
    host (DNS lookup), nc (netcat), traceroute (UDP default, -I
    for ICMP), and tcpdump, plus ss, link, address, route,
    neighbor, and sysctl to introspect and drive the control plane.
    stack start / stack stop manage the daemon lifecycle;
    python -m pytcp runs the package directly.

  • Loopback interface — a real lo inside the stack: locally
    destined IP TX is diverted onto a loopback ring and delivered back
    up, so a server and client sharing one daemon can talk over
    127.0.0.1 / ::1 / their own address, end to end (including TCP).

  • Unprivileged ICMP-Echo (ping) socket
    socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) (the Linux ping
    datagram-socket model) with a raw-socket fallback, wired through the
    daemon, the drop-in, the in-process factory, and the pytcp ping
    engine.

  • Raw-socket Linux paritySOCK_RAW over the drop-in; IPv4 raw
    recv delivers the full IP packet; unbound raw RX receives a copy of
    all matching traffic; TTL / Hop-Limit delivered as cmsg; the
    mandatory ICMPv6 checksum auto-computed; egress-aware source
    selection for multi-homed hosts.

  • AF_PACKET egress tap + pytcp tcpdump — an AF_PACKET-style
    egress tap (dev_queue_xmit_nit parity) captures outbound frames,
    including the ARP/ND queued-packet flush path and loopback traffic.
    pytcp tcpdump captures both directions daemon-native, decodes via
    tshark when available (built-in fallback for ICMPv4/v6 and IPv4
    fragments), and the daemon can capture from boot (--capture /
    --capture-pcap) to record its own autoconfiguration.

  • MLDv2 leave reporting — leaving an IPv6 multicast group now emits
    a departure (a CHANGE_TO_INCLUDE State Change Report, or an MLDv1 Done
    in v1 compatibility mode), and stack shutdown gracefully leaves every
    joined group — the IPv6 analogue of the IGMP leave, closing the last
    host-conformance gap in the multicast plane.

  • TCP send/receive buffer sizing and auto-tuning. SO_RCVBUF now
    drives the advertised receive window (grow-only on a mid-connection
    raise so the window's right edge is never retracted), and SO_SNDBUF
    bounds the send buffer with TCP byte-stream backpressure — a full
    buffer blocks honoring SO_SNDTIMEO, does a partial write, or returns
    EAGAIN. On top of that, Linux-style auto-tuning: receive-buffer
    Dynamic Right-Sizing grows the advertised window toward the
    bandwidth-delay product (tcp_rcv_space_adjust), and the send buffer
    grows with the congestion window (tcp_sndbuf_expand) — working on
    both timestamped and timestamp-less connections, with the receive
    window scale sized at SYN for the configured ceiling. New
    tcp.rmem / tcp.wmem (min/default/max) and tcp.moderate_rcvbuf
    sysctls make the buffer bounds and DRS operator-tunable
    (net.ipv4.tcp_rmem / tcp_wmem / tcp_moderate_rcvbuf parity). The
    conservative default buffer sizes are unchanged, so a connection that
    sets no option and no sysctl behaves exactly as before.

Changed

  • Examples reworked around the daemon (async TCP/UDP echo, FTP,
    multicast service discovery, ping) over the drop-in. The pre-3.0.7
    in-process examples_legacy/ tree was removed; the README now leads
    with a daemon-first Quickstart.

Fixed

  • DHCPv4 client INIT / mid-recv paths are now responsive to stop()
    (no more wedged pytcp stack start).
  • pytcp ping fails cleanly when the daemon is down.
  • Graceful CRITICAL exit when an interface cannot be opened.

Tooling

  • make lint gate expanded: pyright gated, import-linter architectural
    contracts, 8 more mypy strict error codes, and a large pylint
    regression-guard allowlist; TYPE_CHECKING / circular-import cruft
    flattened via a Protocol-seam pattern.

Compatibility

Requires Python 3.14+. Depends on PyTCP-net_proto==3.0.8 and
PyTCP-net_addr==3.0.8 (released in lockstep).

PyTCP-net_proto 3.0.8

Choose a tag to compare

@ccie18643 ccie18643 released this 24 Jul 01:37

3.0.8 — 2026-07-23

Added

  • DNS message codec — a new dns/ protocol family: enums, header,
    name codec, question / resource-record parser and assembler, with
    name-bearing and structured RDATA decoded into typed objects. Backs
    the pytcp host DNS-lookup tool.

Changed

  • IPv4 / IPv6 parsers accept loopback-sourced / own-IP packets (a
    from_loopback flag on PacketRx), supporting the stack-internal
    loopback interface added in PyTCP 3.0.8.

Tests & tooling

  • Mutation-audit hardening: a broad sweep of kill-proven tests closing
    real gaps across TCP (options, AccECN, Fast Open, option walkers),
    UDP checksum handling, ICMPv4 / ICMPv6 message length and
    trailing-padding tolerance, IPv4 / IPv6 parser bounds, DHCPv4 /
    DHCPv6 option-code guards, and DNS header flag distinctness.
  • The Buffer alias moved to net_addr (the dependency-graph bottom).
  • Typing modernization: gratuitous string-quoted annotations dropped,
    forbidden override-ignores refactored, 8 more mypy strict error codes
    enabled.

Compatibility

Requires Python 3.14+. Depends on PyTCP-net_addr==3.0.8.

PyTCP-net_addr 3.0.8

Choose a tag to compare

@ccie18643 ccie18643 released this 24 Jul 01:36

3.0.8 — 2026-07-23

Changed

  • The Buffer alias (bytes | bytearray | memoryview) now lives here,
    in net_addr — the bottom of the dependency graph and its canonical
    home.
  • Address's per-leaf value-type contract is now properly abstract.

Tests & tooling

  • Mutation-audit hardening: kill-proven tests pinning the RFC 5453
    reserved-IID predicate, from_rfc7217 golden vectors, the MAC I/G
    bit, wildcard application, IpNetwork subnetting / overlap / merge /
    summarize boundaries, total-ordering directions, and __format__
    width / unknown-spec rejection.
  • Typing modernization: gratuitous string-quoted annotations dropped,
    8 more mypy strict error codes enabled, @override enforced on all
    test fixture hooks.

Compatibility

Requires Python 3.14+. No runtime dependencies (stdlib only; the
click CLI helpers remain an opt-in [cli] extra).

PyTCP 3.0.7

Choose a tag to compare

@ccie18643 ccie18643 released this 01 Jun 02:56

Pure-Python, zero-dependency TCP/IP stack — the running stack dist (pip install PyTCP).

Highlights since 3.0.6 — the kernel / userspace split

The stack can now run as a daemon: a normal in-process stack that also listens on an AF_UNIX control socket, so a separate process opens sockets and drives the control APIs through pytcp.client — the way a Linux process talks to the kernel. The in-process library form is unchanged; both models ship.

  • First-class daemon entry pointpython -m pytcp.daemon (or the pytcpd console script), defaulting the control socket to $XDG_RUNTIME_DIR/pytcp.sock, with a client-readiness helper.
  • Out-of-process sockets — TCP / UDP / raw / AF_PACKET opened over the boundary, backed by real, selectors-pollable fds passed via SCM_RIGHTS (active connect and passive accept fd-passing).
  • Control plane over IPCclient.sysctl / .route / .link / .address / .neighbor / .membership mirror the in-process control APIs across an AF_UNIX length-prefixed RPC with a tagged value codec.
  • recvmsg ancillary data crosses the datagram boundary.
  • Bundled out-of-process echo example (examples/client__tcp_echo_ipc.py) alongside the in-process form.

Brings in PyTCP-net_proto==3.0.7 + PyTCP-net_addr==3.0.7 (stdlib-only otherwise). Fully typed (ships py.typed), strict-mypy clean, Python 3.14+.

Published via OIDC Trusted Publishing.

PyTCP-net_proto 3.0.7

Choose a tag to compare

@ccie18643 ccie18643 released this 01 Jun 02:54

Protocol packet parse / assemble / validate library, PyTCP 3.0.7 cycle.

Lockstep release — no wire-codec changes since 3.0.6. The 3.0.7 line is the pytcp daemon / kernel-userspace split; net_proto is unchanged and bumped in lockstep.

  • Depends only on PyTCP-net_addr==3.0.7; otherwise stdlib-only. Fully typed, Python 3.14+.
  • Published via OIDC Trusted Publishing.

PyTCP-net_addr 3.0.7

Choose a tag to compare

@ccie18643 ccie18643 released this 01 Jun 02:53

Lockstep maintenance release in the PyTCP 3.0.7 cycle — no functional changes to the address library since 3.0.6. The 3.0.7 line is the pytcp daemon / kernel-userspace split; net_addr is unchanged and bumped in lockstep.

  • Stdlib-only base install; the click-typed CLI helpers remain an opt-in [cli] extra, lazily imported.
  • Fully typed (ships py.typed), strict-mypy clean, Python 3.14+.
  • Published via OIDC Trusted Publishing.

PyTCP 3.0.6

Choose a tag to compare

@ccie18643 ccie18643 released this 31 May 04:53

Pure-Python, zero-dependency TCP/IP stack — the running stack dist (pip install PyTCP).

Highlights since 3.0.5

New host-stack features

  • DHCPv6 client (RFC 8415) — stateful SOLICIT/ADVERTISE/REQUEST/REPLY with IA_NA + stateless INFORMATION-REQUEST, DUID, Rapid Commit, Elapsed Time, server-preference + alternate-server fallback, RENEW/REBIND/RELEASE/DECLINE lifecycle, RA M/O trigger, Address-API DAD decline.
  • IPv4 multicast group membership — host-side IGMPv1/v2/v3 with v1/v2 querier-version fallback, source-specific multicast and per-socket source filters (RFC 1112 / 2236 / 3376).
  • MLDv1 compatibility fallback alongside the MLDv2 listener (RFC 2710 / 3810).
  • AF_PACKET raw link socket + full userspace RFC 5227 ACD / RFC 4436 DNAv4 (sd-ipv4acd model).
  • Multi-interface foundation — per-ifindex interface table, runtime interface add/remove (RTNETLINK semantics), host-mode FIB.

Control-plane (Phase-3 kernel/userspace boundary)

  • RTNETLINK-style APIs: stack.link / stack.address / stack.route / stack.neighbor, plus read-only introspection snapshots and the stack.sysctl registry (incl. per-interface knobs).

Sockets — Linux-parity sweep: SO_REUSEPORT, MSG_OOB/SO_OOBINLINE, SO_LINGER, sendmsg/recvmsg, DSCP marking, multicast membership + source-filter options, TCP_INFO.

Engineering — event-driven heap timer (no polling tick), TCP session decomposition, active PLPMTUD, free-threaded (no-GIL) safety audit closed.

~12,400 unit + integration tests; 125+ per-RFC adherence audits.

  • Depends on PyTCP-net_proto==3.0.6 + PyTCP-net_addr==3.0.6 (lockstep). Stdlib-only otherwise, fully typed, Python 3.14+, Linux (TAP/TUN).
  • Published via OIDC Trusted Publishing.

PyTCP-net_proto 3.0.6

Choose a tag to compare

@ccie18643 ccie18643 released this 31 May 04:52

Protocol packet parse / assemble / validate library, PyTCP 3.0.6 cycle.

New wire codecs since 3.0.5:

  • DHCPv6 (RFC 8415) — 16-bit option codes, IA_NA, DUID, Rapid Commit, Elapsed Time, status/preference options.
  • IGMP host membership — IGMPv1 / v2 / v3 incl. source records (RFC 1112 / 2236 / 3376).
  • MLDv1 (RFC 2710) compatibility codec alongside the existing MLDv2.

Plus a full RFC-adherence + assembler audit pass across all protocols, and the wire-input vs programmer-input validation discipline (typed integrity/sanity raises that survive python -O) confirmed AST-clean.

  • Depends only on PyTCP-net_addr==3.0.6; otherwise stdlib-only. Fully typed, Python 3.14+.
  • Published via OIDC Trusted Publishing.

PyTCP-net_addr 3.0.6

Choose a tag to compare

@ccie18643 ccie18643 released this 31 May 04:51

Maintenance release in the PyTCP 3.0.6 cycle.

  • Refined RFC-accurate address classification (RFC 9637 IPv6 documentation range; NAT64 / SRv6 and additional special-purpose ranges).
  • Stdlib-only base install; the click-typed CLI helpers remain an opt-in [cli] extra, lazily imported.
  • Fully typed (ships py.typed), strict-mypy clean, Python 3.14+.
  • Published via OIDC Trusted Publishing.

PyTCP 3.0.5

Choose a tag to compare

@ccie18643 ccie18643 released this 19 May 17:11

First correctly-packaged PyTCP release. The stack is now the pytcp package depending on PyTCP-net_proto==3.0.5 + PyTCP-net_addr==3.0.5 (lockstep); the historical broken umbrella wheel (3 of 323 files, ≤3.0.4) is resolved by dissolving the monolith into the three-package monorepo.

  • pip install PyTCP now installs a functional stack (130 .py + all namespace subpackages, py.typed) and pulls net_proto + net_addr + aenum.
  • Published via OIDC Trusted Publishing through the tag-restricted pypi GitHub Environment.

The net_addr-v / net_proto-v publish jobs are skipped by the v* release-tag gate.