From 84376ed71915afec2d6d0cb70f9bdad282fa0a64 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Thu, 13 Mar 2025 18:09:46 +0700 Subject: [PATCH] cmd/cli: add missing pre-run setup for start command Otherwise, ctrld won't be able to reset DNS correctly if problems happened during self-check process. --- cmd/cli/cli.go | 2 +- cmd/cli/commands.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index eb3b910..96ed656 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -1061,7 +1061,7 @@ func uninstall(p *prog, s service.Service) { p.resetDNS(false, true) // Iterate over all physical interfaces and restore DNS if a saved static config exists. - withEachPhysicalInterfaces("", "restore static DNS", func(i *net.Interface) error { + withEachPhysicalInterfaces(p.runningIface, "restore static DNS", func(i *net.Interface) error { file := savedStaticDnsSettingsFilePath(i) if _, err := os.Stat(file); err == nil { if err := restoreDNS(i); err != nil { diff --git a/cmd/cli/commands.go b/cmd/cli/commands.go index 6c0c202..c052f44 100644 --- a/cmd/cli/commands.go +++ b/cmd/cli/commands.go @@ -234,6 +234,7 @@ NOTE: running "ctrld start" without any arguments will start already installed c mainLog.Load().Error().Msg(err.Error()) return } + p.preRun() status, err := s.Status() isCtrldRunning := status == service.StatusRunning