cmd/cli: honoring "iface" value in resetDnsTask

Otherwise, ctrld service command will always do reset DNS while it
should not.
This commit is contained in:
Cuong Manh Le
2024-08-26 21:52:44 +07:00
committed by Cuong Manh Le
parent 5af3ec4f7b
commit 70b0c4f7b9

View File

@@ -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.