mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-24 15:26:49 +09:00
state: return a node's primary routes in stable order
They came from map iteration, so an unchanged router rendered its self node differently on every call. Updates #3502
This commit is contained in:
1 parent
31582dd2c2
commit
ba413fca3d
2 files changed
+25
-1
No files matched your search
@@ -986,7 +986,7 @@ func (s *NodeStore) PrimaryRouteFor(prefix netip.Prefix) (types.NodeID, bool) {
|
||||
}
|
||||
|
||||
// PrimaryRoutesForNode returns the prefixes for which id is the current
|
||||
// primary advertiser.
|
||||
// primary advertiser, sorted so an unchanged node renders identically.
|
||||
func (s *NodeStore) PrimaryRoutesForNode(id types.NodeID) []netip.Prefix {
|
||||
snap := s.data.Load()
|
||||
if !snap.isPrimaryRoute[id] {
|
||||
@@ -1001,6 +1001,8 @@ func (s *NodeStore) PrimaryRoutesForNode(id types.NodeID) []netip.Prefix {
|
||||
}
|
||||
}
|
||||
|
||||
slices.SortFunc(out, netip.Prefix.Compare)
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user