ipn, wgengine/magicsock: fix tailscale status display.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-12-15 18:45:13 -08:00
committed by Dave Anderson
parent 891110e64c
commit 294ceb513c
2 changed files with 14 additions and 3 deletions

View File

@ -209,8 +209,14 @@ func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder) {
lastSeen = *p.LastSeen
}
var tailAddr string
if len(p.Addresses) > 0 {
tailAddr = strings.TrimSuffix(p.Addresses[0].String(), "/32")
for _, addr := range p.Addresses {
// The peer struct currently only allows a single
// Tailscale IP address. For compatibility with the
// old display, make sure it's the IPv4 address.
if addr.IP.Is4() && addr.Mask == 32 && tsaddr.IsTailscaleIP(netaddr.IPFrom16(addr.IP.Addr)) {
tailAddr = addr.IP.String()
break
}
}
sb.AddPeer(key.Public(p.Key), &ipnstate.PeerStatus{
InNetworkMap: true,