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 authored and Cuong Manh Le committed 2024-08-07 15:54:22 +07:00
1 parent 8b98faa441
commit e8d3ed1acd
1 file changed
+1 -1
+1 -1
View File
@@ -956,7 +956,7 @@ func savedStaticNameservers(iface *net.Interface) []string {
// dnsChanged reports whether DNS settings for given interface was changed. // dnsChanged reports whether DNS settings for given interface was changed.
// The caller must sort the nameservers before calling this function. // The caller must sort the nameservers before calling this function.
func dnsChanged(iface *net.Interface, nameservers []string) bool { func dnsChanged(iface *net.Interface, nameservers []string) bool {
curNameservers := currentDNS(iface) curNameservers, _ := currentStaticDNS(iface)
slices.Sort(curNameservers) slices.Sort(curNameservers)
return !slices.Equal(curNameservers, nameservers) return !slices.Equal(curNameservers, nameservers)
} }