diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-20 16:05:41 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-20 16:05:41 +0900 |
commit | e0a0fd792d98ce1d092531fc20fcc2b8fa5cffba (patch) | |
tree | 7895159e14d1876c9017d57ae5a3f206ecf4ad06 /server | |
parent | 5af15b1d9c7ef62039356de9874b6d68658ec024 (diff) |
server: properly handle invalid policy config
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/server.go b/server/server.go index b92aec16..16bb0c97 100644 --- a/server/server.go +++ b/server/server.go @@ -884,7 +884,7 @@ func (server *BgpServer) SetPolicy(pl config.RoutingPolicy) error { if err != nil { log.WithFields(log.Fields{ "Topic": "Policy", - }).Debugf("failed to create routing policy: %s", err) + }).Errorf("failed to create routing policy: %s", err) return err } server.policy = p @@ -894,8 +894,13 @@ func (server *BgpServer) SetPolicy(pl config.RoutingPolicy) error { return nil } -func (server *BgpServer) handlePolicy(pl config.RoutingPolicy) { - server.SetPolicy(pl) +func (server *BgpServer) handlePolicy(pl config.RoutingPolicy) error { + if err := server.SetPolicy(pl); err != nil { + log.WithFields(log.Fields{ + "Topic": "Policy", + }).Errorf("failed to set new policy: %s", err) + return err + } for _, peer := range server.neighborMap { log.WithFields(log.Fields{ "Topic": "Peer", @@ -903,6 +908,7 @@ func (server *BgpServer) handlePolicy(pl config.RoutingPolicy) { }).Info("call set policy") server.setPolicyByConfig(peer, peer.conf.ApplyPolicy) } + return nil } func (server *BgpServer) checkNeighborRequest(grpcReq *GrpcRequest) (*Peer, error) { |