diff options
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{ |