From fd3f98792a0d254c2af16e8637c5e0a55dbe587e Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Tue, 21 Apr 2026 06:44:40 +0200 Subject: [PATCH] Clarify checkStub doc and parse-error behavior --- client/internal/dns/host_unix.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/internal/dns/host_unix.go b/client/internal/dns/host_unix.go index 458fb04a0..2b9840fce 100644 --- a/client/internal/dns/host_unix.go +++ b/client/internal/dns/host_unix.go @@ -125,11 +125,17 @@ func getOSDNSManagerType() (osManagerType, error) { return fileManager, nil } -// checkStub checks if the stub resolver is disabled in systemd-resolved. If it is disabled, we fall back to file manager. +// checkStub reports whether systemd-resolved's stub address (127.0.0.53) is +// listed in /etc/resolv.conf. A true return value signals that callers should +// prefer systemd-resolved; it does not make the final manager decision by +// itself (non-stub systems still fall through to the header scanner). +// On parse failure we assume the stub is present to avoid dropping into file +// mode while resolved is active, which would re-ingest NetBird's address as +// an upstream and form a resolution loop. func checkStub() bool { rConf, err := parseDefaultResolvConf() if err != nil { - log.Warnf("failed to parse resolv conf: %s", err) + log.Warnf("failed to parse resolv conf, assuming stub is active: %s", err) return true }