summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--policy/policy.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/policy/policy.go b/policy/policy.go
index 06921eab..2a1524af 100644
--- a/policy/policy.go
+++ b/policy/policy.go
@@ -1089,12 +1089,16 @@ func RegexpRemoveCommunities(path *table.Path, exps []*regexp.Regexp) {
newComms := make([]uint32, 0, len(comms))
for _, comm := range comms {
c := fmt.Sprintf("%d:%d", comm>>16, comm&0x0000ffff)
+ match := false
for _, exp := range exps {
- if !exp.MatchString(c) {
- newComms = append(newComms, comm)
+ if exp.MatchString(c) {
+ match = true
break
}
}
+ if match == false {
+ newComms = append(newComms, comm)
+ }
}
path.SetCommunities(newComms, true)
}