From 01f24907c595ca641035b28159aefe6cf09117d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Garc=C3=AAs?= Date: Tue, 29 Oct 2024 16:49:41 +0000 Subject: [PATCH] [client] Fix multiple peer name filtering in netbird status command (#2798) --- client/cmd/status.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/cmd/status.go b/client/cmd/status.go index ed3daa2b5..6db52a677 100644 --- a/client/cmd/status.go +++ b/client/cmd/status.go @@ -680,7 +680,7 @@ func parsePeers(peers peersStateOutput, rosenpassEnabled, rosenpassPermissive bo func skipDetailByFilters(peerState *proto.PeerState, isConnected bool) bool { statusEval := false ipEval := false - nameEval := false + nameEval := true if statusFilter != "" { lowerStatusFilter := strings.ToLower(statusFilter) @@ -700,11 +700,13 @@ func skipDetailByFilters(peerState *proto.PeerState, isConnected bool) bool { if len(prefixNamesFilter) > 0 { for prefixNameFilter := range prefixNamesFilterMap { - if !strings.HasPrefix(peerState.Fqdn, prefixNameFilter) { - nameEval = true + if strings.HasPrefix(peerState.Fqdn, prefixNameFilter) { + nameEval = false break } } + } else { + nameEval = false } return statusEval || ipEval || nameEval