change: route the double hop from Python, not --up hooks #211
Loading…
Reference in a new issue
No description provided.
Delete branch "change/doublehop-routing-176"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stage 1 of #176: the hop routing model moves out of shell hooks into the tunnel thread, becoming protocol-neutral - the WireGuard stages build on this.
Problem: The double hop's routing lived in
hop.sh/hop_down.sh, OpenVPN--up/--downhooks. Two consequences: the model was OpenVPN-only (WireGuard hop legs have no place to plug in, #176), and the hop server's pin was installed after the hop's handshake - up-hooks run post-handshake - so the handshake it was meant to steer could still ride a dying tunnel's def1 routes when switching from an active connection (#202).Change:
--route-noexec;tunnel_upinstalls each leg's routes at CONNECTED. The hop steers the main server into its device; the main leg takes the def1 pair - the same routing modelwireguard.pyalready uses.pin_server_route, shared with the bypass path now) is installed before the hop leg launches, and is proto-111-tagged - a killed service's startup sweep already flushes those, so crash cleanup comes free.hop.sh/hop_down.shdeleted,setup.pyfollows.Verification: 10 new tests (pin-precedes-launch, per-leg route install, route-failure aborts, teardown/failure unpin, leg command lines); full suite 520 passed. Needs live double-hop runs before merge: fresh connect, switch from an active connection (the #202 scenario), and failure teardown.
Part of #176. Closes #202.
🤖 Generated with Claude Code
Two commits added after the first live round (log-verified: fresh doublehop, switch-while-connected, and proto-111 teardown all behaved; the switch handshake completed 50ms in while the old tunnel was still dying - the #202 path working):
6ade813- the Python route installs now log themselves ("Pinned ... via ...", "Routed ... into ..."); the shell hooks used to announce themselves through OpenVPN's script exec lines and their replacements were silent.98095e6- fixes the frozen-uptime observation from that round: on a switch, the dying thread'sdev=Noneteardown landed on the shared role state after the new thread's pre-launch announcement, so the gui started its monitor on interface None and it died one tick in. Pre-existing race, not a regression from this PR - quick switching just surfaced it. CONNECTED now re-announces the device ahead of the status signal.Remaining before merge: one more run checking egress (curl should show the main server's exit, not the hop's) and that uptime now counts across a switch.
Live verification complete (2026-08-29):
98095e6.ip route show proto 111empty after disconnect.Ready to merge.