From 96fd20e3c0b67beb70535e77ce41f50b1979cab9 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 16 Sep 2020 07:54:01 -0700 Subject: [PATCH] ipn: bail out a bit earlier when a peer doesn't have a DNS name It's properly handled later in tsdns.NewMap anyway, but there's work done in the meantime that can be skipped when a peer lacks a DNS name. It's also more clear that it's okay for it to be blank. --- ipn/local.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipn/local.go b/ipn/local.go index 2e67f0ac7..fc994bcd1 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -555,7 +555,7 @@ func (b *LocalBackend) updateDNSMap(netMap *controlclient.NetworkMap) { nameToIP := make(map[string]netaddr.IP) set := func(name string, addrs []wgcfg.CIDR) { - if len(addrs) == 0 { + if len(addrs) == 0 || name == "" { return } nameToIP[name] = netaddr.IPFrom16(addrs[0].IP.Addr)