001 / LINUX GATEWAY · POLICY MATRIX · SATL · RUST
Sodama Next
A clean-room Rust Linux gateway: identity × traffic × destination routing, a policy matrix, SATL that only reorders new connections, and sixteen eBPF programs / twenty-five maps behind a reversible snapshot shared by a sixteen-page console and AI change tickets. The repository is not public yet.
STATUS DEPLOYED TRIAL · PRIVATE SOURCE
QUESTION
Can a transparent gateway move from destination-based routing to identity × traffic × destination × policy, while keeping the eBPF fast path, userspace snapshots, SATL, a 16-page console and AI change tickets explainable, reversible and testable?
PRACTICE
Sodama Next is a clean-room Rust Linux transparent gateway. It is not a branch of the public Sodama (the AGPL datapath rewrite) and contains no dae code. Its invariants are more stable than its modules: Linux only; eBPF is an accelerator, not a prerequisite; device identity is routing identity, not authentication; dynamic policy never enters eBPF; SATL only reorders new connections; configuration is the single source of truth; every state that can grow has a bound; unsafe lives only in the runtime and eBPF layers; the console is a separate process; and AI cannot change the data plane without confirmation.
Configuration is nine top-level blocks plus include (global, dns, dataset, device, group, node, subscription, routing, satl); unknown sections, keys and values are rejected. Routing compiles identity, traffic, destination and network context together: thirteen matcher classes cover domains, addresses, ports, transport, source MAC, device, process and DSCP. Four tiers give device-scoped rules, global-mode device defaults, global rules and rule-mode device defaults explicit positions. The console’s device × site-set → egress matrix writes marked routing rules ahead of handwritten ones, which still override specific names; unknown devices fall to the global fallback.
SATL is not a second rule system: once a group is selected it only reorders members for new connections and never migrates established ones. Shadow records, active samples, and a per-device off / shadow / active override can supersede the global mode; the JSONL journal records only target kind, port, transport, intent and candidate cost, and can be replayed offline. Outbounds have five group policies, a fastest pool, pin, TCP / HTTP(S) probes and hedged dialing. Thirteen configured kinds plus ShadowTLS v3 make fourteen named variants; UDP support is declared per protocol and unsupported combinations return Unsupported instead of falling back to direct. Subscriptions, geosite / geoip, Clash and sing-box providers all carry size, item-count and refresh semantics.
The data plane has sixteen eBPF program names and twenty-five maps: TC classification and observation, control-plane correction, sockmap offload, cgroup process-name mapping and optional XDP. routing_map uses a two-epoch buffer, conn_state_map holds 262,144 entries, domain_routing_map 131,072, and event_ringbuf is 256 KiB. Rules are capped at 1,024, expanded match sets at 2,048, devices at 64, userspace concurrent forwarding at 4,096 and transparent UDP flows at 1,024; every growing table has a janitor or a capacity alert, and a failed insert is counted. The runtime is a per-core poll(2) + splice(2) reactor with 2–16 workers, bounded queues and 64 KiB backpressure. QUIC / h2 protocols close a Tokio runtime inside a synchronous thread instead of turning the reactor async. The local proxy uses nftables output REDIRECT and does not rely on /dev/net/tun.
The control plane has two 0600 Unix sockets: status.sock speaks a one-line protocol plus nineteen v2 JSON commands, ipc.sock speaks typed IPC v3. CLI and console share the same commands; there is no second source of state. The console is a separate axum + Leptos WASM process with sixteen pages in five navigation groups. Structured editing rewrites only the modelled blocks and preserves untouched rules, comments and fields byte for byte; apply carries an expected_hash and rolls back to an mtime-rotated backup on failure. The AI assistant has thirty-one tools (ten read, twenty-one write) and defaults to propose: writes become change tickets with diff, preflight, postflight and rollback, subscription URLs are redacted in the diff, and it cannot restart the engine.
The capability map also records the boundaries: no TUN or ICMP forwarding; per-session TCP offload and kTLS are off by default; transparent DNS interception is opt-in; the management plane is still one shared token with no per-user audit; console events still lack the chosen node, byte counts, SATL cost and DNS answer; Docker / CI and OpenWrt packaging are unfinished; the 72-hour soak has not started. The repository and license are not public yet.
The relationship to the public Sodama needs to be explicit: Sodama is an AGPL Rust rewrite of dae’s core datapath; Sodama Next is a clean-room project covering identity routing, the full gateway surface, the console and AI operations. Their numbers, licenses and code paths are not interchangeable.
EVIDENCE
The evidence that can be shared falls into four groups: current build facts, two recent production observations, the 6.5-day trial and local benchmarks.
Current build (2026-11-24, main@7582992): 673 engine tests and 119 console tests pass (16 ignored); sixteen eBPF program names and twenty-five maps; fourteen engine crates and three console crates; sixteen console pages in five groups; thirty-one AI tools (ten read, twenty-one write).
A 32.4-hour RSS observation (2026-11-22 15:51 – 11-24 00:13 CST, 387 five-minute samples): RSS stepped from 67.8 MiB to 96.4 MiB at 11-23 00:05–00:10, in the same samples as 263 threads, 870 fds and 108 connections. The following twenty hours averaged 96.46 MiB (min 96.17, max 97.42), not a continuing rise. The 24 maps then in service reported map_full_total=0; 130,616 DNS queries had zero failures and zero drops; event_drops=0. The cause is a glibc high-water mark across seven arenas plus THP, not a map, DNS or event-ring leak; the engine is about 2.5% of 3,828 MB.
A 22-hour production run (2026-11-18, 1,341 minute samples): CPU averaged 0.80%, p50 0.35%, p95 2.48%, p99 7.62%, max 20.85%, with zero minutes at or above 90%; 42.58 GB crossed the interfaces; NRestarts=0; low-traffic minutes (<50 kB/s) averaged 0.40% and peaked at 3.18%.
The 6 d 12 h trial (2026-11-10 – 11-16, 9,348 minute samples) remains the availability evidence: CPU averaged 2.25%, p95 3.47%, max 29.72%; RSS stepped once from about 59 MB to about 102 MB; one subscription group sat at 0/72 from 11-14 for 3,973 minutes because a cached 403 subscription still counted 73 stale nodes as usable; the window logged 396,242 relay failures and 9,004 dial deadlines; 90.0% of 458,160 SATL observations were no_candidate. The CPU and memory shape can be closed; availability cannot, and the 72-hour soak has not started.
Local five-way SOCKS5 (2026-11-08, i9-9900KF / 7.2.14, 3 rounds × 4 streams × 32 MiB, memcmp-verified echo): 44.3 Gbps (42.2–45.1), 8.7 MB RSS at 2,000 connections and 4,024 fds; sing-box 43.4 / 91.0 MB, v2ray 24.4 / 131.5, mihomo 38.4 / 85.7, old sodama 15.1 / 128.1. At 200 concurrent streams it reached 51.1 Gbps; 4,096 connections used 9.6 MB and 8,216 fds. The transparent path is not ahead (honk 2.4–5.7, old sodama 9.5–10.4 Gbps); that number stays because the SOCKS5 entry and the transparent path are not the same measurement.
All numbers belong to a specific version, machine and window; the repository is not public, so only aggregates are shown—no nodes, endpoints or credentials. The 32.4-hour, 22-hour and 6.5-day windows are not one “long-term stable” claim.
RUST / AYA-EBPF / TC · SOCKMAP · CGROUP · XDP / SATL / LEPTOS-WASM CONSOLE / AI
The repository and license are not public yet; this page only presents the architecture and aggregate measurements that can be shared, without subscription endpoints, node domains or production credentials.
← Back to selected work→