Skip to content

Commit

Permalink
[client] Fix multiple peer name filtering in netbird status command (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mgarces authored Oct 29, 2024
1 parent 10480eb commit 01f2490
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 01f2490

Please sign in to comment.