mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Fix: Filter root domain from search domains on Linux
Remove empty and root domain (".") entries from search domains list
to prevent systemd-resolved errors. This addresses the issue where
systemd doesn't allow root domain in search domains configuration.
The filtering ensures only valid search domains are passed to
systemd-resolved, preventing DNS operation failures.
This commit is contained in:
committed by
Cuong Manh Le
parent
6c550b1d74
commit
091c7edb19
@@ -72,7 +72,15 @@ func setDNS(iface *net.Interface, nameservers []string) error {
|
|||||||
SearchDomains: []dnsname.FQDN{},
|
SearchDomains: []dnsname.FQDN{},
|
||||||
}
|
}
|
||||||
if sds, err := searchDomains(); err == nil {
|
if sds, err := searchDomains(); err == nil {
|
||||||
osConfig.SearchDomains = sds
|
// Filter the root domain, since it's not allowed by systemd.
|
||||||
|
// See https://github.com/systemd/systemd/issues/9515
|
||||||
|
filteredSds := slices.DeleteFunc(sds, func(s dnsname.FQDN) bool {
|
||||||
|
return s == "" || s == "."
|
||||||
|
})
|
||||||
|
if len(filteredSds) != len(sds) {
|
||||||
|
mainLog.Load().Debug().Msg(`Removed root domain "." from search domains list`)
|
||||||
|
}
|
||||||
|
osConfig.SearchDomains = filteredSds
|
||||||
} else {
|
} else {
|
||||||
mainLog.Load().Debug().Err(err).Msg("failed to get search domains list")
|
mainLog.Load().Debug().Err(err).Msg("failed to get search domains list")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user