mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
policy: fix removing community wich multiple regexp conditions
Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
+6
-2
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user