policy: fix removing community wich multiple regexp conditions

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2015-10-06 13:50:34 +09:00
parent 76a9bb4c59
commit 00860b2676
+6 -2
View File
@@ -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)
}