cmd/cli: use currentStaticDNS when checking DNS changed

The dns watchdog is spawned *after* DNS was set by ctrld, thus it should
use the currentStaticDNS for getting the static DNS, instead of relying
on currentDNS, which could be system wide instead of per interfaces.
This commit is contained in:
Cuong Manh Le
2024-08-06 00:17:17 +07:00
committed by Cuong Manh Le
parent 8b98faa441
commit e8d3ed1acd

View File

@@ -956,7 +956,7 @@ func savedStaticNameservers(iface *net.Interface) []string {
// dnsChanged reports whether DNS settings for given interface was changed.
// The caller must sort the nameservers before calling this function.
func dnsChanged(iface *net.Interface, nameservers []string) bool {
curNameservers := currentDNS(iface)
curNameservers, _ := currentStaticDNS(iface)
slices.Sort(curNameservers)
return !slices.Equal(curNameservers, nameservers)
}