From 7b9c7bc42bba4e2299b4227003b6392f59455a41 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 8 Dec 2021 09:44:03 -0800 Subject: [PATCH] ipn/ipnstate: remove old deprecated TailAddr IPv4-only field It's been a bunch of releases now since the TailscaleIPs slice replacement was added. Change-Id: I3bd80e1466b3d9e4a4ac5bedba8b4d3d3e430a03 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 36 +++++++++++++-------------------- ipn/ipnstate/ipnstate.go | 6 +----- wgengine/magicsock/magicsock.go | 9 --------- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 6a934bfee..22d249dd4 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -417,16 +417,9 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) { if p.LastSeen != nil { lastSeen = *p.LastSeen } - var tailAddr4 string var tailscaleIPs = make([]netaddr.IP, 0, len(p.Addresses)) for _, addr := range p.Addresses { if addr.IsSingleIP() && tsaddr.IsTailscaleIP(addr.IP()) { - if addr.IP().Is4() && tailAddr4 == "" { - // The peer struct previously only allowed a single - // Tailscale IP address. For compatibility for a few releases starting - // with 1.8, keep it pulled out as IPv4-only for a bit. - tailAddr4 = addr.IP().String() - } tailscaleIPs = append(tailscaleIPs, addr.IP()) } } @@ -434,21 +427,20 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) { return r.Bits() == 0 }) sb.AddPeer(p.Key, &ipnstate.PeerStatus{ - InNetworkMap: true, - ID: p.StableID, - UserID: p.User, - TailAddrDeprecated: tailAddr4, - TailscaleIPs: tailscaleIPs, - HostName: p.Hostinfo.Hostname, - DNSName: p.Name, - OS: p.Hostinfo.OS, - KeepAlive: p.KeepAlive, - Created: p.Created, - LastSeen: lastSeen, - Online: p.Online != nil && *p.Online, - ShareeNode: p.Hostinfo.ShareeNode, - ExitNode: p.StableID != "" && p.StableID == b.prefs.ExitNodeID, - ExitNodeOption: exitNodeOption, + InNetworkMap: true, + ID: p.StableID, + UserID: p.User, + TailscaleIPs: tailscaleIPs, + HostName: p.Hostinfo.Hostname, + DNSName: p.Name, + OS: p.Hostinfo.OS, + KeepAlive: p.KeepAlive, + Created: p.Created, + LastSeen: lastSeen, + Online: p.Online != nil && *p.Online, + ShareeNode: p.Hostinfo.ShareeNode, + ExitNode: p.StableID != "" && p.StableID == b.prefs.ExitNodeID, + ExitNodeOption: exitNodeOption, }) } } diff --git a/ipn/ipnstate/ipnstate.go b/ipn/ipnstate/ipnstate.go index 96dbda755..518847582 100644 --- a/ipn/ipnstate/ipnstate.go +++ b/ipn/ipnstate/ipnstate.go @@ -88,8 +88,7 @@ type PeerStatus struct { OS string // HostInfo.OS UserID tailcfg.UserID - TailAddrDeprecated string `json:"TailAddr"` // Tailscale IP - TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node + TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node // Endpoints: Addrs []string @@ -244,9 +243,6 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) { if v := st.UserID; v != 0 { e.UserID = v } - if v := st.TailAddrDeprecated; v != "" { - e.TailAddrDeprecated = v - } if v := st.TailscaleIPs; v != nil { e.TailscaleIPs = v } diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 7f9e2f7b4..df4b73d03 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -3097,7 +3097,6 @@ func (c *Conn) UpdateStatus(sb *ipnstate.StatusBuilder) { c.mu.Lock() defer c.mu.Unlock() - var tailAddr4 string var tailscaleIPs []netaddr.IP if c.netMap != nil { tailscaleIPs = make([]netaddr.IP, 0, len(c.netMap.Addresses)) @@ -3106,13 +3105,6 @@ func (c *Conn) UpdateStatus(sb *ipnstate.StatusBuilder) { continue } sb.AddTailscaleIP(addr.IP()) - // TailAddr previously only allowed for a - // single Tailscale IP. For compatibility for - // a couple releases starting with 1.8, keep - // that field pulled out separately. - if addr.IP().Is4() { - tailAddr4 = addr.IP().String() - } tailscaleIPs = append(tailscaleIPs, addr.IP()) } } @@ -3135,7 +3127,6 @@ func (c *Conn) UpdateStatus(sb *ipnstate.StatusBuilder) { } } ss.TailscaleIPs = tailscaleIPs - ss.TailAddrDeprecated = tailAddr4 }) c.peerMap.forEachEndpoint(func(ep *endpoint) {