ipn/ipnlocal: initialize DNS config maps unconditionally.

Fixes #1963.

Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit df350e2069)
This commit is contained in:
David Anderson 2021-05-20 20:22:21 -07:00
parent 33ff4a25b2
commit 593ee7c7f1

View File

@ -1708,7 +1708,10 @@ func (b *LocalBackend) authReconfig() {
rcfg := b.routerConfig(cfg, uc)
var dcfg dns.Config
dcfg := dns.Config{
Routes: map[dnsname.FQDN][]netaddr.IPPort{},
Hosts: map[dnsname.FQDN][]netaddr.IP{},
}
// Populate MagicDNS records. We do this unconditionally so that
// quad-100 can always respond to MagicDNS queries, even if the OS
@ -1740,7 +1743,6 @@ func (b *LocalBackend) authReconfig() {
dcfg.Hosts[fqdn] = ips
}
dcfg.AuthoritativeSuffixes = magicDNSRootDomains(nm)
dcfg.Hosts = map[dnsname.FQDN][]netaddr.IP{}
set(nm.Name, nm.Addresses)
for _, peer := range nm.Peers {
set(peer.Name, peer.Addresses)
@ -1759,9 +1761,6 @@ func (b *LocalBackend) authReconfig() {
}
addDefault(nm.DNS.Resolvers)
if len(nm.DNS.Routes) > 0 {
dcfg.Routes = map[dnsname.FQDN][]netaddr.IPPort{}
}
for suffix, resolvers := range nm.DNS.Routes {
fqdn, err := dnsname.ToFQDN(suffix)
if err != nil {