diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-03-31 15:29:40 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-31 16:36:27 +0900 |
commit | e6682c52ba3e09c4111bc94c938909cdcacd7d72 (patch) | |
tree | 8c77697343742e300c5302a7b7adbeb52e9d6eb1 /server/peer.go | |
parent | 0bd939e92677a03436d7b7f2ec97e953d736464b (diff) |
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 <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 32 |
1 files changed, 32 insertions, 0 deletions
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{ |