all: preserve search domains settings

So bare hostname will be resolved as expected when ctrld is running.
This commit is contained in:
Cuong Manh Le
2025-05-08 22:29:59 +07:00
committed by Cuong Manh Le
parent 00e9d2bdd3
commit 62f73bcaa2
9 changed files with 99 additions and 8 deletions
+4
View File
@@ -100,6 +100,10 @@ func setDNS(iface *net.Interface, nameservers []string) error {
}
}
// Note that Windows won't modify the current search domains if passing nil to luid.SetDNS function.
// searchDomains is still implemented for Windows just in case Windows API changes in future versions.
_ = searchDomains
if len(serversV4) == 0 && len(serversV6) == 0 {
return errors.New("invalid DNS nameservers")
}