From fedb250230f1ce7c488f55494b2a62b95e967987 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Mon, 17 Jul 2023 12:59:44 -0500 Subject: [PATCH] Backport of add a conditional around setting LANFilter.AllSegments to make sure it is valid into release/1.16.x (#18146) * no-op commit due to failed cherry-picking * add a conditional around setting LANFilter.AllSegments to make sure it is valid (#18139) This is to correct a code problem because this assumes all segments, but when you get to Enterprise, you can be in partition that is not the default partition, in which case specifying all segments does not validate and fails. This is to correct the setting of this filter with `AllSegments` to `true` to only occur when in the the `default` partition. * [ ] updated test coverage * [ ] external facing docs updated * [ ] appropriate backport labels added * [ ] not a security concern --------- Co-authored-by: temp Co-authored-by: John Murret --- agent/ui_endpoint.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/ui_endpoint.go b/agent/ui_endpoint.go index 8f5184969693..dc44853101eb 100644 --- a/agent/ui_endpoint.go +++ b/agent/ui_endpoint.go @@ -190,7 +190,11 @@ func AgentMembersMapAddrVer(s *HTTPHandlers, req *http.Request) (map[string]stri filter := consul.LANMemberFilter{ Partition: entMeta.PartitionOrDefault(), } - filter.AllSegments = true + + if acl.IsDefaultPartition(filter.Partition) { + filter.AllSegments = true + } + lanMembers, err := s.agent.delegate.LANMembers(filter) if err != nil { return nil, err