net/dns: remove some unused code for detecting systemd-resolved [Linux]

Change-Id: I19c5fd2cdacfb9e5b688ccd9b4336ae4edffc445
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-02-11 07:47:13 -08:00 committed by Brad Fitzpatrick
parent 15599323a1
commit 37e7a387ff

View File

@ -74,38 +74,6 @@ type resolvedLinkDomain struct {
RoutingOnly bool RoutingOnly bool
} }
// isResolvedActive determines if resolved is currently managing system DNS settings.
func isResolvedActive() bool {
ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout)
defer cancel()
conn, err := dbus.SystemBus()
if err != nil {
// Probably no DBus on the system, or we're not allowed to use
// it. Cannot control resolved.
return false
}
rd := conn.Object("org.freedesktop.resolve1", dbus.ObjectPath("/org/freedesktop/resolve1"))
call := rd.CallWithContext(ctx, "org.freedesktop.DBus.Peer.Ping", 0)
if call.Err != nil {
// Can't talk to resolved.
return false
}
config, err := newDirectManager(logger.Discard).readResolvFile(resolvConf)
if err != nil {
return false
}
// The sole nameserver must be the systemd-resolved stub.
if len(config.Nameservers) == 1 && config.Nameservers[0] == resolvedListenAddr {
return true
}
return false
}
// resolvedManager is an OSConfigurator which uses the systemd-resolved DBus API. // resolvedManager is an OSConfigurator which uses the systemd-resolved DBus API.
type resolvedManager struct { type resolvedManager struct {
logf logger.Logf logf logger.Logf