net/dns: work around new NetworkManager in other selection paths.

Further bits of #1788

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/1791/head
David Anderson 4 years ago
parent 25ce9885a2
commit f6b7d08aea

@ -97,11 +97,22 @@ func NewOSConfigurator(logf logger.Logf, interfaceName string) (ret OSConfigurat
dbg("src-is-nm", "yes") dbg("src-is-nm", "yes")
if err := dbusPing("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/DnsManager"); err == nil { if err := dbusPing("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/DnsManager"); err == nil {
dbg("nm", "yes") dbg("nm", "yes")
return newNMManager(interfaceName) old, err := nmVersionOlderThan("1.26.6")
if err != nil {
return nil, fmt.Errorf("checking NetworkManager version: %v", err)
}
if old {
dbg("nm-old", "yes")
return newNMManager(interfaceName)
} else {
dbg("nm-old", "no")
}
} else {
dbg("nm", "no")
} }
dbg("nm", "no") } else {
dbg("src-is-nm", "no")
} }
dbg("src-is-nm", "no")
if _, err := exec.LookPath("resolvconf"); err != nil { if _, err := exec.LookPath("resolvconf"); err != nil {
dbg("resolvconf", "no") dbg("resolvconf", "no")
return newDirectManager() return newDirectManager()
@ -115,7 +126,16 @@ func NewOSConfigurator(logf logger.Logf, interfaceName string) (ret OSConfigurat
return newDirectManager() return newDirectManager()
} }
dbg("nm", "yes") dbg("nm", "yes")
return newNMManager(interfaceName) old, err := nmVersionOlderThan("1.26.6")
if err != nil {
return nil, fmt.Errorf("checking NetworkManager version: %v", err)
}
if old {
dbg("nm-old", "yes")
return newNMManager(interfaceName)
}
dbg("nm-old", "no")
return newDirectManager()
default: default:
dbg("rc", "unknown") dbg("rc", "unknown")
return newDirectManager() return newDirectManager()

Loading…
Cancel
Save