fix DNS failure on network change with upstream re-detection
Upstream DNS was resolved once at startup and never updated. Switching Wi-Fi networks made all queries fail until restart. Now spawns a background task (every 30s) that re-runs system DNS discovery and swaps the upstream atomically if it changed. Also flushes stale LAN peers from the old network on change. Only activates when upstream is auto-detected (not explicitly configured). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -341,8 +341,9 @@ async fn diagnose(
|
||||
}
|
||||
|
||||
// Check upstream (async, no locks held)
|
||||
let upstream = *ctx.upstream.lock().unwrap();
|
||||
let (upstream_matched, upstream_detail) =
|
||||
forward_query_for_diagnose(&domain_lower, ctx.upstream, ctx.timeout).await;
|
||||
forward_query_for_diagnose(&domain_lower, upstream, ctx.timeout).await;
|
||||
steps.push(DiagnoseStep {
|
||||
source: "upstream".to_string(),
|
||||
matched: upstream_matched,
|
||||
|
||||
Reference in New Issue
Block a user