From 265b008e49064adeef2e1d544cd13308fcf4f3cd Mon Sep 17 00:00:00 2001 From: James Tucker Date: Thu, 1 Sep 2022 10:51:44 -0700 Subject: [PATCH] wgengine: fix race on endpoints in getStatus Signed-off-by: James Tucker --- wgengine/userspace.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index f573dfd88..aabb57d60 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -1005,6 +1005,7 @@ func (e *userspaceEngine) getStatus() (*Status, error) { closing := e.closing peerKeys := make([]key.NodePublic, len(e.peerSequence)) copy(peerKeys, e.peerSequence) + localAddrs := append([]tailcfg.Endpoint(nil), e.endpoints...) e.mu.Unlock() if closing { @@ -1020,7 +1021,7 @@ func (e *userspaceEngine) getStatus() (*Status, error) { return &Status{ AsOf: time.Now(), - LocalAddrs: append([]tailcfg.Endpoint(nil), e.endpoints...), + LocalAddrs: localAddrs, Peers: peers, DERPs: derpConns, }, nil