Files
OpenFlux/signals_unix.go
T
damnurmum 032d6af0a1 tun_watch: remove bypass routes on Stop(), catch SIGHUP
SocketWatcher.addRoute() installs a /32 bypass route through the
physical gateway for every remote IP the process talks to directly,
so the transport's own sockets stay off the tunnel. Stop() never
removed them, so after the client exited the routes stayed in the
table pinned to whatever gateway was current at that moment. Once the
network changed (different Wi-Fi, another VPN, a hotspot), traffic to
that specific IP kept following the stale route instead of the new
default route - breaking reachability to that one host while
everything else worked fine.

Stop() now removes every route it added. Also notify on SIGHUP, since
that's what a closed terminal window sends the foreground process
(not SIGINT/SIGTERM) - previously that path skipped cleanup entirely.
2026-09-17 22:00:41 +03:00

17 lines
414 B
Go

//go:build !windows
package main
import (
"os"
"os/signal"
"syscall"
)
func notifySignals(ch chan os.Signal) {
// SIGHUP is what a closed terminal window sends the foreground process
// (not SIGINT/SIGTERM) - without catching it, closing the window instead
// of Ctrl+C skips the bypass-route cleanup in SocketWatcher.Stop() entirely.
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
}