From e6682c52ba3e09c4111bc94c938909cdcacd7d72 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Thu, 31 Mar 2016 15:29:40 +0900 Subject: server: update path-attributes when peer is disconnected close #807 also add a test to check this issue is fixed Signed-off-by: ISHIDA Wataru --- server/peer.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'server/peer.go') diff --git a/server/peer.go b/server/peer.go index a8b67b63..f5491b33 100644 --- a/server/peer.go +++ b/server/peer.go @@ -165,6 +165,38 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* return pathList, filtered } +func (peer *Peer) processOutgoingPaths(paths []*table.Path) []*table.Path { + if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED { + return nil + } + if peer.fsm.pConf.GracefulRestart.State.LocalRestarting { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.conf.Config.NeighborAddress, + }).Debug("now syncing, suppress sending updates") + return nil + } + + outgoing := make([]*table.Path, 0, len(paths)) + options := &table.PolicyOptions{ + Neighbor: peer.fsm.peerInfo.Address, + } + for _, path := range paths { + path = peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path), options) + if path == nil { + continue + } + if !peer.isRouteServerClient() && !peer.gConf.Collector.Enabled { + path = path.Clone(path.IsWithdraw) + path.UpdatePathAttrs(&peer.gConf, &peer.conf) + } + outgoing = append(outgoing, path) + } + + peer.adjRibOut.Update(outgoing) + return outgoing +} + func (peer *Peer) handleBGPmessage(e *FsmMsg) ([]*table.Path, []*bgp.BGPMessage, []bgp.RouteFamily) { m := e.MsgData.(*bgp.BGPMessage) log.WithFields(log.Fields{ -- cgit v1.2.3