From b32cf57ed11c9f28197564f156523b41458ff216 Mon Sep 17 00:00:00 2001 From: crn4 Date: Wed, 21 Jan 2026 17:12:34 +0100 Subject: [PATCH] minor fixes on diffs --- management/server/types/account_components.go | 10 +++++++--- management/server/types/networkmap_components.go | 12 ++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/management/server/types/account_components.go b/management/server/types/account_components.go index 153813afe..daba109e2 100644 --- a/management/server/types/account_components.go +++ b/management/server/types/account_components.go @@ -42,6 +42,7 @@ func (a *Account) GetPeerNetworkMapComponents( RoutersMap: make(map[string]map[string]*routerTypes.NetworkRouter), NetworkResources: make([]*resourceTypes.NetworkResource, 0), PostureFailedPeers: make(map[string]map[string]struct{}, len(a.PostureChecks)), + RouterPeers: make(map[string]*nbpeer.Peer), } components.AccountSettings = &AccountSettingsInfo{ @@ -161,9 +162,12 @@ func (a *Account) GetPeerNetworkMapComponents( components.RoutersMap[resource.NetworkID] = networkRoutingPeers for peerIDKey := range networkRoutingPeers { - if _, exists := components.Peers[peerIDKey]; !exists { - if _, validated := validatedPeersMap[peerIDKey]; validated { - if p := a.Peers[peerIDKey]; p != nil { + if p := a.Peers[peerIDKey]; p != nil { + if _, exists := components.RouterPeers[peerIDKey]; !exists { + components.RouterPeers[peerIDKey] = p + } + if _, exists := components.Peers[peerIDKey]; !exists { + if _, validated := validatedPeersMap[peerIDKey]; validated { components.Peers[peerIDKey] = p } } diff --git a/management/server/types/networkmap_components.go b/management/server/types/networkmap_components.go index 5ac1b0352..042193cbf 100644 --- a/management/server/types/networkmap_components.go +++ b/management/server/types/networkmap_components.go @@ -41,6 +41,8 @@ type NetworkMapComponents struct { GroupIDToUserIDs map[string][]string AllowedUserIDs map[string]struct{} PostureFailedPeers map[string]map[string]struct{} + + RouterPeers map[string]*nbpeer.Peer } type AccountSettingsInfo struct { @@ -54,6 +56,10 @@ func (c *NetworkMapComponents) GetPeerInfo(peerID string) *nbpeer.Peer { return c.Peers[peerID] } +func (c *NetworkMapComponents) GetRouterPeerInfo(peerID string) *nbpeer.Peer { + return c.RouterPeers[peerID] +} + func (c *NetworkMapComponents) GetGroupInfo(groupID string) *Group { return c.Groups[groupID] } @@ -479,6 +485,9 @@ func (calc *NetworkMapCalculator) getRoutesToSync(ctx context.Context, peerID st func (calc *NetworkMapCalculator) getRoutingPeerRoutes(ctx context.Context, peerID string) (enabledRoutes []*route.Route, disabledRoutes []*route.Route) { peerInfo := calc.components.GetPeerInfo(peerID) + if peerInfo == nil { + peerInfo = calc.components.GetRouterPeerInfo(peerID) + } if peerInfo == nil { return enabledRoutes, disabledRoutes } @@ -960,6 +969,9 @@ func (calc *NetworkMapCalculator) addNetworksRoutingPeers( for p := range missingPeers { peerInfo := calc.components.GetPeerInfo(p) + if peerInfo == nil { + peerInfo = calc.components.GetRouterPeerInfo(p) + } if peerInfo != nil { peersToConnect = append(peersToConnect, peerInfo) }