diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-06 13:50:34 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-06 13:50:34 +0900 |
commit | 00860b2676d760ce06c2ff2f3d926fa80eee7a10 (patch) | |
tree | 5e336162b0e5bd0004ed136923d665c4686c966b /policy | |
parent | 76a9bb4c59e14b3ee04a0c3d1d60028b42717953 (diff) |
policy: fix removing community wich multiple regexp conditions
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'policy')
-rw-r--r-- | policy/policy.go | 8 |
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) } |