mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
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:
parent
15599323a1
commit
37e7a387ff
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user