fix: doublehop route hooks, hang on hop failure, cli reporting, leftover devices #201
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/doublehop-179"
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?
Problem
Doublehop is broken end to end on any current system, and fails by hanging instead of reporting (#179):
hop.sh/hop_down.shcall/sbin/route(net-tools), which no longer exists — OpenVPN treats the failed--upas fatal and the leg dies on every attempt, GUI and cli alike.connect_status, so the TunnelThread spins at 1 Hz forever inside the root service; only a service restart clears it._hopvariants pass silently, and the hop bookkeeping swallowed the main tunnel's bareconnection_established, so-vhung on success too.Fix
One commit per layer:
hop.sh/hop_down.shrewritten with idempotentip route replace/del; the hop-server pin isproto 111-tagged so the #78 startup sweep clears it after a crash, andset -emakes a half-routed leg impossible. The_gatewayliteral inhop_down.shis gone (a proto-qualified del needs no gateway).connect_status = -1); the wait turns that into a raise, andreport_failurealready drops both legs' firewall rules and reports the failed attempt. A hop stuck retrying deliberately keeps the wait: each retry emitsconn_attempt_failed_hop, a client kills the leg, and that lands in the same abort path.main()so the module imports cleanly under pytest.tunnel.remove_tun_device(): each leg deletes its own device after process exit (exactTUN_DEVICESnames only), and service start sweeps all three next to the #78 route sweep.Verification
bash -non both scripts.packaging/arch/build-branch-and-install.shfrom this branch, thenaqomui-cli -v <hop> -c <server>on ProtonVPN (plan allows two concurrent connections). Worth checking while at it: failure path (bogus hop server → clean abort, no stranded thread),ip routeshows the proto-111 pin gone after disconnect, and notun_aqomui_hleft behind — plus the #88 speed numbers.Closes #179
Fifth commit: an exception inside the hop leg's own bring-up (no process, so no EOF) could still arm the hang — the leg now runs behind a hop_leg wrapper that logs the error and releases the wait. Closes the #17 unguarded-helper-thread gap for the hop. 502 tests pass.
Live verification complete (2026-08-29):
One pre-existing quirk surfaced: switching from an active connection into doublehop races the old tunnel's teardown (the hop pin only lands at --up). A single-hop switch survives via OpenVPN's retry; the hop leg dies on first failure because clients kill on conn_attempt_failed_hop. Candidate follow-up issue, not this PR's scope. From a fresh disconnect the same pair connects reliably.