summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-10-06 13:50:34 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-10-06 13:50:34 +0900
commit00860b2676d760ce06c2ff2f3d926fa80eee7a10 (patch)
tree5e336162b0e5bd0004ed136923d665c4686c966b
parent76a9bb4c59e14b3ee04a0c3d1d60028b42717953 (diff)
policy: fix removing community wich multiple regexp conditions
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-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)
}