summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-20 08:39:13 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-20 09:17:22 +0000
commit733b05b83185d3c1dd0c783462d91a10400c0ae2 (patch)
tree4c6a8f869634c42b38eda6ada4f1608c8afebb8e /table
parente21e48410a6ff36db38973c59aca0b8f89083809 (diff)
policy: don't allow same policy assigned twice
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/policy.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/table/policy.go b/table/policy.go
index 424a8562..66416931 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -2690,11 +2690,16 @@ func (r *RoutingPolicy) GetAssignmentFromConfig(dir PolicyDirection, a config.Ap
def = ROUTE_TYPE_REJECT
}
ps := make([]*Policy, 0, len(names))
+ seen := make(map[string]bool)
for _, name := range names {
p, ok := r.PolicyMap[name]
if !ok {
return nil, def, fmt.Errorf("not found policy %s", name)
}
+ if seen[name] {
+ return nil, def, fmt.Errorf("duplicated policy %s", name)
+ }
+ seen[name] = true
ps = append(ps, p)
}
return ps, def, nil