diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-20 06:11:03 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-27 10:32:42 +0000 |
commit | ec0d19acd5b738da2a4aa90e7da6f3c1a1a2844f (patch) | |
tree | 8455a7ebb99fed4d91c431f55e0e5297c9cf4a83 /server | |
parent | 43f3d009d63e7d4d354a2a8b87f5967f3135b74e (diff) |
server: support peer re-configuration
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index 0869917d..4810378e 100644 --- a/server/server.go +++ b/server/server.go @@ -2315,6 +2315,7 @@ func (server *BgpServer) handleAddNeighbor(c *config.Neighbor) ([]*SenderMsg, er SetTcpMD5SigSockopts(l, addr, c.Config.AuthPassword) } } + log.Info("Add a peer configuration for ", addr) peer := NewPeer(&server.bgpConfig.Global, c, server.globalRib, server.policy) server.setPolicyByConfig(peer.ID(), c.ApplyPolicy) @@ -2360,6 +2361,10 @@ func (server *BgpServer) handleDelNeighbor(c *config.Neighbor) ([]*SenderMsg, er }(addr) delete(server.neighborMap, addr) m := server.dropPeerAllRoutes(n, n.configuredRFlist()) + + notification := bgp.NewBGPNotificationMessage(bgp.BGP_ERROR_CEASE, bgp.BGP_ERROR_SUB_PEER_DECONFIGURED, nil) + m = append(m, newSenderMsg(n, nil, notification, false)) + return m, nil } @@ -2375,6 +2380,26 @@ func (server *BgpServer) handleUpdateNeighbor(c *config.Neighbor) ([]*SenderMsg, } original := peer.fsm.pConf + if !original.Config.Equal(&c.Config) || !original.Transport.Config.Equal(&c.Transport.Config) { + msgs, err := server.handleDelNeighbor(peer.fsm.pConf) + if err != nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": addr, + }).Error(err) + return msgs, policyUpdated, err + } + msgs2, err := server.handleAddNeighbor(c) + msgs = append(msgs, msgs2...) + if err != nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": addr, + }).Error(err) + } + return msgs, policyUpdated, err + } + msgs, err := peer.updatePrefixLimitConfig(c.AfiSafis) if err != nil { log.WithFields(log.Fields{ |