mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-01 17:49:02 +00:00
ipn/ipnlocal: fix StatusWithoutPeers not populating parts of Status
Fixes #4311 Change-Id: Iaae0615148fa7154f4ef8f66b455e3a6c2fa9df3 Co-authored-by: Claire Wang <claire@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
3c452b9880
commit
0f604923d3
@@ -3545,12 +3545,14 @@ func (c *Conn) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
||||
ss.TailscaleIPs = tailscaleIPs
|
||||
})
|
||||
|
||||
c.peerMap.forEachEndpoint(func(ep *endpoint) {
|
||||
ps := &ipnstate.PeerStatus{InMagicSock: true}
|
||||
//ps.Addrs = append(ps.Addrs, n.Endpoints...)
|
||||
ep.populatePeerStatus(ps)
|
||||
sb.AddPeer(ep.publicKey, ps)
|
||||
})
|
||||
if sb.WantPeers {
|
||||
c.peerMap.forEachEndpoint(func(ep *endpoint) {
|
||||
ps := &ipnstate.PeerStatus{InMagicSock: true}
|
||||
//ps.Addrs = append(ps.Addrs, n.Endpoints...)
|
||||
ep.populatePeerStatus(ps)
|
||||
sb.AddPeer(ep.publicKey, ps)
|
||||
})
|
||||
}
|
||||
|
||||
c.foreachActiveDerpSortedLocked(func(node int, ad activeDerp) {
|
||||
// TODO(bradfitz): add to ipnstate.StatusBuilder
|
||||
|
||||
@@ -219,6 +219,7 @@ func (s *magicStack) Public() key.NodePublic {
|
||||
|
||||
func (s *magicStack) Status() *ipnstate.Status {
|
||||
var sb ipnstate.StatusBuilder
|
||||
sb.WantPeers = true
|
||||
s.conn.UpdateStatus(&sb)
|
||||
return sb.Status()
|
||||
}
|
||||
|
||||
@@ -1265,13 +1265,15 @@ func (e *userspaceEngine) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
||||
e.logf("wgengine: getStatus: %v", err)
|
||||
return
|
||||
}
|
||||
for _, ps := range st.Peers {
|
||||
sb.AddPeer(ps.NodeKey, &ipnstate.PeerStatus{
|
||||
RxBytes: int64(ps.RxBytes),
|
||||
TxBytes: int64(ps.TxBytes),
|
||||
LastHandshake: ps.LastHandshake,
|
||||
InEngine: true,
|
||||
})
|
||||
if sb.WantPeers {
|
||||
for _, ps := range st.Peers {
|
||||
sb.AddPeer(ps.NodeKey, &ipnstate.PeerStatus{
|
||||
RxBytes: int64(ps.RxBytes),
|
||||
TxBytes: int64(ps.TxBytes),
|
||||
LastHandshake: ps.LastHandshake,
|
||||
InEngine: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
e.magicConn.UpdateStatus(sb)
|
||||
|
||||
Reference in New Issue
Block a user