diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-06-20 10:54:35 +0900 |
---|---|---|
committer | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-06-20 11:24:05 +0900 |
commit | 1c7829604d492dde7d9cdd491a77fe3d70797691 (patch) | |
tree | 78e38c269fccf0668faa7a34f0100f679c6be654 /server/server.go | |
parent | d75edf18d7febd3f687393e8b0707e57438931eb (diff) |
peer: Check errors in creating Dynamic Peers
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index d1b0b0ff..1ecbedf0 100644 --- a/server/server.go +++ b/server/server.go @@ -241,6 +241,14 @@ func (server *BgpServer) Serve() { "Topic": "Peer", }).Debugf("Accepted a new dynamic neighbor from:%s", remoteAddr) peer := newDynamicPeer(&server.bgpConfig.Global, remoteAddr, pg.Conf, server.globalRib, server.policy) + if peer == nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": remoteAddr, + }).Infof("Can't create new Dynamic Peer") + conn.Close() + return + } server.policy.Reset(nil, map[string]config.ApplyPolicy{peer.ID(): peer.fsm.pConf.ApplyPolicy}) server.neighborMap[remoteAddr] = peer peer.startFSMHandler(server.fsmincomingCh, server.fsmStateCh) |