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.
This commit is contained in:
Brad Fitzpatrick 2020-09-16 07:54:01 -07:00
parent 7f97cf654d
commit 96fd20e3c0

View File

@ -555,7 +555,7 @@ func (b *LocalBackend) updateDNSMap(netMap *controlclient.NetworkMap) {
nameToIP := make(map[string]netaddr.IP) nameToIP := make(map[string]netaddr.IP)
set := func(name string, addrs []wgcfg.CIDR) { set := func(name string, addrs []wgcfg.CIDR) {
if len(addrs) == 0 { if len(addrs) == 0 || name == "" {
return return
} }
nameToIP[name] = netaddr.IPFrom16(addrs[0].IP.Addr) nameToIP[name] = netaddr.IPFrom16(addrs[0].IP.Addr)