summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-03-24 13:22:34 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-03-24 22:27:12 +0900
commit22bc21ebea87b381838477e070ae4cb70e263d66 (patch)
tree51ad17a7ddcea6e2fc1a31755ccf447bf4f419a4 /server
parent5902ba02e8f804da9363bc99654e0e8292f006c7 (diff)
policy: test policy existence
Diffstat (limited to 'server')
-rw-r--r--server/peer.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/peer.go b/server/peer.go
index 33ec9103..107a39fb 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -116,8 +116,10 @@ func (peer *Peer) setPolicy(policyMap map[string]*policy.Policy) {
"Key": peer.peerConfig.NeighborAddress,
"PolicyName": policyName,
}).Info("import policy installed")
- log.Debug("import policy : ", policyMap[policyName])
- inPolicies = append(inPolicies, policyMap[policyName])
+ if pol, ok := policyMap[policyName]; ok {
+ log.Debug("import policy : ", pol)
+ inPolicies = append(inPolicies, pol)
+ }
}
peer.importPolicies = inPolicies
@@ -129,8 +131,10 @@ func (peer *Peer) setPolicy(policyMap map[string]*policy.Policy) {
"Key": peer.peerConfig.NeighborAddress,
"PolicyName": policyName,
}).Info("export policy installed")
- log.Debug("export policy : ", policyMap[policyName])
- outPolicies = append(outPolicies, policyMap[policyName])
+ if pol, ok := policyMap[policyName]; ok {
+ log.Debug("export policy : ", pol)
+ outPolicies = append(outPolicies, pol)
+ }
}
peer.exportPolicies = outPolicies
}