From 70b0c4f7b9da8fd5c157803b1af563ee4c921925 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 26 Aug 2024 21:52:44 +0700 Subject: [PATCH] cmd/cli: honoring "iface" value in resetDnsTask Otherwise, ctrld service command will always do reset DNS while it should not. --- cmd/cli/cli.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 2f4916c..987a470 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -2649,6 +2649,9 @@ func resetDnsTask(p *prog, s service.Service) task { isCtrldInstalled := !errors.Is(err, service.ErrNotInstalled) isCtrldRunning := status == service.StatusRunning return task{func() error { + if iface == "" { + return nil + } // Always reset DNS first, ensuring DNS setting is in a good state. // resetDNS must use the "iface" value of current running ctrld // process to reset what setDNS has done properly.