net/dns: improve NetworkManager detection, using more DBus.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-04-11 03:37:14 -07:00
parent 9a48bac8ad
commit 84430cdfa1
3 changed files with 44 additions and 13 deletions

View File

@@ -1010,15 +1010,18 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, routerCfg *router.Config,
}
if routerChanged {
e.logf("wgengine: Reconfig: configuring DNS")
err := e.dns.Set(*dnsCfg)
health.SetDNSHealth(err)
e.logf("wgengine: Reconfig: configuring router")
err := e.router.Set(routerCfg)
health.SetRouterHealth(err)
if err != nil {
return err
}
e.logf("wgengine: Reconfig: configuring router")
err = e.router.Set(routerCfg)
health.SetRouterHealth(err)
// Keep DNS configuration after router configuration, as some
// DNS managers refuse to apply settings if the device has no
// assigned address.
e.logf("wgengine: Reconfig: configuring DNS")
err = e.dns.Set(*dnsCfg)
health.SetDNSHealth(err)
if err != nil {
return err
}