fix: return DNS selection to the primary once it answers again #96
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dns-fallback-watchdog"
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
#95: systemd-resolved abandons a failed DNS server but never returns while the substitute keeps answering, and re-applying an identical server list does not reset its selection. A one-second blip during a ping-restart reconnect stranded the system on the fallback indefinitely — observed live twice in one afternoon while verifying #34. For a split-horizon primary that failure is silent: internal names resolve to their public addresses from then on, nothing looks broken, and there is no obvious way to notice or recover.
Fix
CurrentDNSServeron the resolve1 Link — no text parsing), and when it is not the primary, send one UDP probe straight at the primary. If it answers, force re-selection: set the primary alone, restore the pair, flush the answers the fallback served. Worst case is one 15s check interval on the fallback instead of forever.tunnel_up(OpenVPN main role) and the WireGuard connect path; exits on its own when the link disappears; each CONNECTED starts one if none is running, so it survives ping-restarts whether or not the device blinks. Explicitly stopped when the OpenVPN process exits.--strict-order: slot order is priority, not a pool, so its favour-the-working-server logic can't strand bypass lookups on the fallback either.Verification
current_dns_server("tun_aqomui")returns the correct current server via D-Bus; probes at the real AdGuard and Quad9 answer, TEST-NET times out, a missing link returns None.DNS: ... answers again - selection returned from ...log line marks it firing.Closes #95
Design note — polling vs events, tested live: resolved emits PropertiesChanged only when the configured server list changes (Manager-level
DNSproperty). An induced selection switch (dead TEST-NET primary → fallback) fired no signal at all:CurrentDNSServerchanges silently, so there is nothing to subscribe to and a periodic peek is the only detection. The idle tick is one local D-Bus property read (no DNS traffic); the UDP probe only runs while the fallback is in use. The idle interval bounds the worst-case time on the fallback, which is why it stays at 15s.