From 8bb0cc324b23be1c25313188210aa287270bf09f Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Mon, 24 Nov 2025 16:45:53 +0000 Subject: [PATCH] fix(dns): prevent dns restart crash if `DOT=off` and `DNS_KEEP_NAMESERVER=off` --- internal/dns/run.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/dns/run.go b/internal/dns/run.go index 430ab0ef..2fec05a9 100644 --- a/internal/dns/run.go +++ b/internal/dns/run.go @@ -82,7 +82,8 @@ func (l *Loop) runWait(ctx context.Context, runError <-chan error) (exitLoop boo for { select { case <-ctx.Done(): - if !*l.GetSettings().KeepNameserver { + settings := l.GetSettings() + if !*settings.KeepNameserver && *settings.ServerEnabled { l.stopServer() // TODO revert OS and Go nameserver when exiting } @@ -90,7 +91,8 @@ func (l *Loop) runWait(ctx context.Context, runError <-chan error) (exitLoop boo case <-l.stop: l.userTrigger = true l.logger.Info("stopping") - if !*l.GetSettings().KeepNameserver { + settings := l.GetSettings() + if !*settings.KeepNameserver && *settings.ServerEnabled { const fallback = false l.useUnencryptedDNS(fallback) l.stopServer()