summaryrefslogtreecommitdiffhomepage
path: root/table/policy.go
diff options
context:
space:
mode:
authortamihiro <dead6oy@gmail.com>2016-04-18 17:03:39 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-20 12:19:35 +0900
commite06bb04f14bc24eddf24e40aa340a8a05a99c637 (patch)
tree40dc58e25c44e2b9f3dc181e40f259350d3abd39 /table/policy.go
parent4e07254d0a0d52099d1cc12b4a3fcd6cb97132bd (diff)
fix community-set match all evaluation and remove regexp special chars from cli output of community strings
Diffstat (limited to 'table/policy.go')
-rw-r--r--table/policy.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/table/policy.go b/table/policy.go
index 2a8c759f..8a174284 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -1345,10 +1345,10 @@ func (c *CommunityCondition) ToApiStruct() *api.MatchSet {
func (c *CommunityCondition) Evaluate(path *Path, _ *PolicyOptions) bool {
cs := path.GetCommunities()
result := false
- for _, x := range cs {
+ for _, x := range c.set.list {
result = false
- for _, y := range c.set.list {
- if y.MatchString(fmt.Sprintf("%d:%d", x>>16, x&0x0000ffff)) {
+ for _, y := range cs {
+ if x.MatchString(fmt.Sprintf("%d:%d", y>>16, y&0x0000ffff)) {
result = true
break
}
@@ -1356,7 +1356,7 @@ func (c *CommunityCondition) Evaluate(path *Path, _ *PolicyOptions) bool {
if c.option == MATCH_OPTION_ALL && !result {
break
}
- if c.option == MATCH_OPTION_ANY && result {
+ if (c.option == MATCH_OPTION_ANY || c.option == MATCH_OPTION_INVERT) && result {
break
}
}