Repository navigation
test(spike): TPROXY Phase 0b — full ruleset, both transports, proven on a node - #944
Merged
Merged
Conversation
…a node Phase 0 proved one thing: a transparent UDP socket created inside a pod netns via setns and read from outside sees the pre-divert destination. It never installed a prerouting `tproxy` rule, never ran TCP, never sent a reply, and never exercised the rule that keeps the design from breaking every pod. This does all four with the exact ruleset the CNI will program. Arms: T1 TCP to VIP:8080 lands on ONE transparent listener on 18001 with getsockname() == VIP:8080 and the reply (src VIP) returns; T2 TCP :53 is not diverted; U1 a UDP reply sent from VIP:18082 via IP_PKTINFO spec_dst reaches a CONNECTED client; S1 an inbound connection from a peer netns over a veth to a plain server in the pod netns, run twice -- WITH `ct direction reply accept` (must connect) and with it REMOVED (must fail). Under redirect-all the server's SYN-ACK is locally-generated TCP with dport = the client's ephemeral port; without that rule it is marked, looped to lo, tproxy'd to the 18001 LISTEN socket and answered with a reset. A run where S1 passes without the rule is a broken rig, not a pass. Exit 0 = every arm as designed incl. S1's red state; 1 = the design fails on this kernel; 2 = rig broken (a control did not run or did not discriminate, including nft rejecting the table because nft_tproxy is unavailable). Same Job shape as Phase 0: NET_ADMIN + SYS_ADMIN, no host namespaces. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… state proven main-worker-04, 6.18.34-talos, first run, exit 0. T1 one transparent TCP listener on 18001 sees VIP:8080 and replies (SO_ORIGINAL_DST = 10.250.0.7:8080, so Envoy's original_dst takes its normal branch on a diverted flow); T2 :53 not diverted; U1 UDP reply from VIP:18082 reaches a connected client; S1 inbound replies survive with `ct direction reply accept` and BOTH ends time out without it. nft_tproxy loads on this kernel. PR 3 is written against this ruleset. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| s.setsockopt(socket.IPPROTO_IP, IP_TRANSPARENT, 1) | ||
| s.bind(("0.0.0.0", CAPTURE_PORT)) |
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| s.setsockopt(socket.IPPROTO_IP, IP_TRANSPARENT, 1) | ||
| s.setsockopt(socket.IPPROTO_IP, socket.IP_PKTINFO, 1) | ||
| s.bind(("0.0.0.0", UDP_PORT)) |
This was referenced Sep 26, 2026
Merged
bpalermo
added a commit
that referenced
this pull request
Sep 26, 2026
…UDP leg (#949) Chart 0.93.3 -> 0.94.0: #947 changed what every managed pod's CNI programs (mark-and-divert for both transports, no REDIRECT) and where plaintext UDP is served (18082, transparent, per-VIP matcher). A breaking data-plane change takes a minor bump; the deploy notes are in the PR. e2e/soak/udp.yaml: the first continuous UDP client on talos-main -- `udp-echo` (UDP-primary, socat RECVFROM echo, 3 replicas spread, a self-parented UDPRoute) and the `udp-dialer` DaemonSet dialling udp-echo.<ns>.aether.internal:18082 from every node with a unique token per datagram, reporting AETHER_METRIC udp_dialer={cycles,ok,fail}. The echo answers a CONNECTED nc client from the dialled port, verified locally as non-root with a read-only root. README: run step, grading subsection (dialer tallies, the udp.capture_udp_* rx/tx series, udp_no_healthy_backend, and the CNI's capture_divert error counter that must stay at zero), files entry. docs/proposals/038: status note recording that Phases 1, 2 and 5 were superseded by the both-transports plan and shipped as #944-#948 with no mode flag; Phases 3 and 4 stand. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 0 of the TPROXY plan. The gate for the CNI change: PR 3 will be written against this exact ruleset, which has now run on a Talos kernel. Refs #916.
What Phase 0 had not established
Phase 0 proved a transparent UDP socket created inside a pod netns via
setnsand read from outside sees the pre-divert destination. It never installed a preroutingtproxyrule (so never provednft_tproxyloads on 6.18.34-talos), never ran TCP, never sent a reply, and never exercised the one rule that keeps the design from breaking every pod.Result —
main-worker-04, first run, exit 0Why S1 is the arm that matters
A
type routechain sees every locally-generated packet. Under redirect-all that includes the pod's own server replies to inbound clients — a SYN-ACK whosedportis the client's ephemeral port. Withoutct direction reply acceptit is marked, looped tolo,tproxy'd to the 18001 LISTEN socket, and answered with a reset: every inbound connection to every redirect-all pod dies. This was the adversarial review's critical finding against the first draft, and S1 is run twice so the rule's absence is seen to break something — a run where S1 passes without the rule exits 2 (rig broken), not 0.ct state established,related acceptis not a substitute: in a route chain it would also exempt the 2nd+ packets of the pod's own captured outbound flows, routing them outeth0mid-connection.Two facts from T1 worth keeping
tproxy to :18001looks the socket up by target port with the header intact; the accepted socket's local endpoint isVIP:8080and the reply is correct with no conntrack NAT. Delivery-port rewrite is fine for TCP and not for UDP (reply source port = bound port), which is why U1 binds the dialed port.SO_ORIGINAL_DSTsucceeds on a diverted flow — tracked but un-NATed,getorigdstreturns the original destination, the same answergetsocknamegives. Envoy'soriginal_dsttakes its normal branch; theIP_TRANSPARENTfallback is a backstop.Shape
Same as Phase 0:
aether-system(already PodSecurityprivileged),NET_ADMIN+SYS_ADMIN, no host namespaces, noprivileged: true. Setup failures raise, the ruleset is verified withnft list rulesetbefore measuring, and a control that does not discriminate is a broken rig. Cluster resources cleaned up after the run.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr