mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
net/dns: remove systemd-resolved ping
Ping only needed to ensure system awak otherwise utilizing resolvConf to set dns mode. Signed-off-by: nyghtowl <warrick@tailscale.com>
This commit is contained in:
parent
617a2ec7cc
commit
e6e1976c3a
@ -112,10 +112,6 @@ func dnsMode(logf logger.Logf, env newOSConfigEnv) (ret string, err error) {
|
|||||||
dbg("resolved", "not-in-use")
|
dbg("resolved", "not-in-use")
|
||||||
return "direct", nil
|
return "direct", nil
|
||||||
}
|
}
|
||||||
if !resolvedUp {
|
|
||||||
dbg("resolved", "no")
|
|
||||||
return "direct", nil
|
|
||||||
}
|
|
||||||
if err := env.dbusPing("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/DnsManager"); err != nil {
|
if err := env.dbusPing("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/DnsManager"); err != nil {
|
||||||
dbg("nm", "no")
|
dbg("nm", "no")
|
||||||
return "systemd-resolved", nil
|
return "systemd-resolved", nil
|
||||||
@ -217,11 +213,6 @@ func dnsMode(logf logger.Logf, env newOSConfigEnv) (ret string, err error) {
|
|||||||
}
|
}
|
||||||
dbg("nm-resolved", "yes")
|
dbg("nm-resolved", "yes")
|
||||||
|
|
||||||
if !resolvedUp {
|
|
||||||
dbg("resolved", "no")
|
|
||||||
return "direct", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// See large comment above for reasons we'd use NM rather than
|
// See large comment above for reasons we'd use NM rather than
|
||||||
// resolved. systemd-resolved is actually in charge of DNS
|
// resolved. systemd-resolved is actually in charge of DNS
|
||||||
// configuration, but in some cases we might need to configure
|
// configuration, but in some cases we might need to configure
|
||||||
|
@ -69,13 +69,13 @@ func TestLinuxDNSMode(t *testing.T) {
|
|||||||
want: "direct",
|
want: "direct",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "resolved_not_running",
|
name: "resolved_alone_without_ping",
|
||||||
env: env(resolvDotConf("# Managed by systemd-resolved", "nameserver 127.0.0.53")),
|
env: env(resolvDotConf("# Managed by systemd-resolved", "nameserver 127.0.0.53")),
|
||||||
wantLog: "dns: [rc=resolved resolved=no ret=direct]",
|
wantLog: "dns: [rc=resolved nm=no ret=systemd-resolved]",
|
||||||
want: "direct",
|
want: "systemd-resolved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "resolved_alone",
|
name: "resolved_alone_with_ping",
|
||||||
env: env(
|
env: env(
|
||||||
resolvDotConf("# Managed by systemd-resolved", "nameserver 127.0.0.53"),
|
resolvDotConf("# Managed by systemd-resolved", "nameserver 127.0.0.53"),
|
||||||
resolvedRunning()),
|
resolvedRunning()),
|
||||||
@ -162,17 +162,17 @@ func TestLinuxDNSMode(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// More than one user has had resolvconf write a config that points to
|
// More than one user has had resolvconf write a config that points to
|
||||||
// systemd-resolved. We're better off using systemd-resolved.
|
// systemd-resolved. We're better off using systemd-resolved.
|
||||||
// ...but what if systemd-resolved isn't running?
|
// and assuming that even if the ping doesn't show that env is correct
|
||||||
// regression test for https://github.com/tailscale/tailscale/issues/3026
|
// regression test for https://github.com/tailscale/tailscale/issues/3026
|
||||||
name: "allegedly_resolvconf_but_actually_systemd-resolved_but_not_really",
|
name: "allegedly_resolvconf_but_actually_systemd-resolved_but_no_ping",
|
||||||
env: env(resolvDotConf(
|
env: env(resolvDotConf(
|
||||||
"# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)",
|
"# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)",
|
||||||
"# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN",
|
"# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN",
|
||||||
"# 127.0.0.53 is the systemd-resolved stub resolver.",
|
"# 127.0.0.53 is the systemd-resolved stub resolver.",
|
||||||
"# run \"systemd-resolve --status\" to see details about the actual nameservers.",
|
"# run \"systemd-resolve --status\" to see details about the actual nameservers.",
|
||||||
"nameserver 127.0.0.53")),
|
"nameserver 127.0.0.53")),
|
||||||
wantLog: "dns: [rc=resolved resolved=no ret=direct]",
|
wantLog: "dns: [rc=resolved nm=no ret=systemd-resolved]",
|
||||||
want: "direct",
|
want: "systemd-resolved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
||||||
@ -188,14 +188,14 @@ func TestLinuxDNSMode(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
||||||
name: "networkmanager_but_pointing_at_systemd-resolved_but_no_resolved",
|
name: "networkmanager_but_pointing_at_systemd-resolved_but_no_resolved_ping",
|
||||||
env: env(resolvDotConf(
|
env: env(resolvDotConf(
|
||||||
"# Generated by NetworkManager",
|
"# Generated by NetworkManager",
|
||||||
"nameserver 127.0.0.53",
|
"nameserver 127.0.0.53",
|
||||||
"options edns0 trust-ad"),
|
"options edns0 trust-ad"),
|
||||||
nmRunning("1.32.12", true)),
|
nmRunning("1.32.12", true)),
|
||||||
wantLog: "dns: [rc=nm nm-resolved=yes resolved=no ret=direct]",
|
wantLog: "dns: [rc=nm nm-resolved=yes nm-safe=no ret=systemd-resolved]",
|
||||||
want: "direct",
|
want: "systemd-resolved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
// regression test for https://github.com/tailscale/tailscale/issues/3304
|
||||||
|
Loading…
x
Reference in New Issue
Block a user