Check if system is our manager when resolvconf (#590)

Sometimes resolvconf will manage the /etc/resolv.conf file
And systemd-resolved still the DNS manager
This commit is contained in:
Maycon Santos
2022-11-29 13:37:50 +01:00
committed by GitHub
parent ae500b63a7
commit 4a30b66503
2 changed files with 27 additions and 0 deletions

View File

@@ -68,6 +68,16 @@ func getOSDNSManagerType() (osManagerType, error) {
return systemdManager, nil
}
if strings.Contains(text, "resolvconf") {
if isDbusListenerRunning(systemdResolvedDest, systemdDbusObjectNode) {
var value string
err = getSystemdDbusProperty(systemdDbusResolvConfModeProperty, &value)
if err == nil {
if value == systemdDbusResolvConfModeForeign {
return systemdManager, nil
}
}
log.Errorf("got an error while checking systemd resolv conf mode, error: %s", err)
}
return resolvConfManager, nil
}
}