diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-03-24 13:22:34 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-24 22:27:12 +0900 |
commit | 22bc21ebea87b381838477e070ae4cb70e263d66 (patch) | |
tree | 51ad17a7ddcea6e2fc1a31755ccf447bf4f419a4 /server/peer.go | |
parent | 5902ba02e8f804da9363bc99654e0e8292f006c7 (diff) |
policy: test policy existence
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 12 |
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 } |