mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-27 10:47:35 +00:00
net/dns: add health check for particular broken-ish Linux DNS config
Updates #3937 (need to write docs before closing) Change-Id: I1df7244cfbb0303481e2621ee750d21358bd67c6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
57115e923e
commit
2ff481ff10
@ -64,6 +64,9 @@ const (
|
|||||||
// SysDNSOS is the name of the net/dns OSConfigurator subsystem.
|
// SysDNSOS is the name of the net/dns OSConfigurator subsystem.
|
||||||
SysDNSOS = Subsystem("dns-os")
|
SysDNSOS = Subsystem("dns-os")
|
||||||
|
|
||||||
|
// SysDNSManager is the name of the net/dns manager subsystem.
|
||||||
|
SysDNSManager = Subsystem("dns-manager")
|
||||||
|
|
||||||
// SysNetworkCategory is the name of the subsystem that sets
|
// SysNetworkCategory is the name of the subsystem that sets
|
||||||
// the Windows network adapter's "category" (public, private, domain).
|
// the Windows network adapter's "category" (public, private, domain).
|
||||||
// If it's unhealthy, the Windows firewall rules won't match.
|
// If it's unhealthy, the Windows firewall rules won't match.
|
||||||
@ -110,6 +113,10 @@ func DNSHealth() error { return get(SysDNS) }
|
|||||||
// SetDNSOSHealth sets the state of the net/dns.OSConfigurator
|
// SetDNSOSHealth sets the state of the net/dns.OSConfigurator
|
||||||
func SetDNSOSHealth(err error) { set(SysDNSOS, err) }
|
func SetDNSOSHealth(err error) { set(SysDNSOS, err) }
|
||||||
|
|
||||||
|
// SetDNSManagerHealth sets the state of the Linux net/dns manager's
|
||||||
|
// discovery of the /etc/resolv.conf situation.
|
||||||
|
func SetDNSManagerHealth(err error) { set(SysDNSManager, err) }
|
||||||
|
|
||||||
// DNSOSHealth returns the net/dns.OSConfigurator error state.
|
// DNSOSHealth returns the net/dns.OSConfigurator error state.
|
||||||
func DNSOSHealth() error { return get(SysDNSOS) }
|
func DNSOSHealth() error { return get(SysDNSOS) }
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
"inet.af/netaddr"
|
"inet.af/netaddr"
|
||||||
|
"tailscale.com/health"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/util/cmpver"
|
"tailscale.com/util/cmpver"
|
||||||
)
|
)
|
||||||
@ -216,7 +217,7 @@ func dnsMode(logf logger.Logf, env newOSConfigEnv) (ret string, err error) {
|
|||||||
}
|
}
|
||||||
dbg("nm-resolved", "yes")
|
dbg("nm-resolved", "yes")
|
||||||
|
|
||||||
if err := env.dbusPing("org.freedesktop.resolve1", "/org/freedesktop/resolve1"); err != nil {
|
if !resolvedUp {
|
||||||
dbg("resolved", "no")
|
dbg("resolved", "no")
|
||||||
return "direct", nil
|
return "direct", nil
|
||||||
}
|
}
|
||||||
@ -241,6 +242,7 @@ func dnsMode(logf logger.Logf, env newOSConfigEnv) (ret string, err error) {
|
|||||||
dbg("nm-safe", "yes")
|
dbg("nm-safe", "yes")
|
||||||
return "network-manager", nil
|
return "network-manager", nil
|
||||||
}
|
}
|
||||||
|
health.SetDNSManagerHealth(errors.New("systemd-resolved and NetworkManager are wired together incorrectly; MagicDNS will probably not work. For more info, see https://tailscale.com/s/resolved-nm"))
|
||||||
dbg("nm-safe", "no")
|
dbg("nm-safe", "no")
|
||||||
return "systemd-resolved", nil
|
return "systemd-resolved", nil
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user