From c8deed69ae6333c718555468c459ed0f3f587bac Mon Sep 17 00:00:00 2001 From: Anton Tolchanov Date: Mon, 5 May 2025 09:59:49 +0100 Subject: [PATCH] net/dns: use fallback resolvers as default if they are absent Otherwise we reset DNS configuration to empty after failing to collect base OS configuration from dns.noopManager, e.g. ``` 2025/05/08 05:48:08 wgengine: Reconfig: configuring DNS 2025/05/08 05:48:08 dns: Set: {DefaultResolvers:[] Routes:{cat-ray.ts.net.:[] ts.net.:[199.247.155.53 2620:111:8007::53]}+65arpa SearchDomains:[cat-ray.ts.net.] Hosts:50} 2025/05/08 05:48:08 health(warnable=dns-read-os-config-failed): error: Tailscale failed to fetch the DNS configuration of your device: getting OS base config is not supported 2025/05/08 05:48:08 health(warnable=dns): error: getting OS base config is not supported 2025/05/08 05:48:08 [v1] authReconfig: ra=false dns=true 0x00: getting OS base config is not supported 2025/05/08 05:48:08 [v1] authReconfig: ra=false dns=true 0x00: ``` --- net/dns/manager.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/dns/manager.go b/net/dns/manager.go index 756816611..98494bf1a 100644 --- a/net/dns/manager.go +++ b/net/dns/manager.go @@ -185,15 +185,15 @@ func (m *Manager) setLocked(cfg Config) error { cfg.WriteToBufioWriter(w) })) + if !cfg.hasDefaultResolvers() && len(m.forceFallbackResolvers) > 0 { + cfg.DefaultResolvers = m.forceFallbackResolvers + } + rcfg, ocfg, err := m.compileConfig(cfg) if err != nil { return err } - if _, ok := rcfg.Routes["."]; !ok && len(m.forceFallbackResolvers) > 0 { - rcfg.Routes["."] = m.forceFallbackResolvers - } - m.logf("Resolvercfg: %v", logger.ArgWriter(func(w *bufio.Writer) { rcfg.WriteToBufioWriter(w) }))