diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-11-09 21:11:03 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-11-12 21:21:54 -0800 |
commit | 0ef26666ef8e920d3fa0a4ebb9c3c8fea4e6cb36 (patch) | |
tree | 8cf03170029be413806a6ef3d73c5eae9ac68ccc /server/peer.go | |
parent | 6d52e8c1e5d4de4dfea37656b50c71579343b5f7 (diff) |
table: use old best path instead of withdrawn paths
Preparation for removing in-memory adj-out.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/server/peer.go b/server/peer.go index 4c76248c..15c25353 100644 --- a/server/peer.go +++ b/server/peer.go @@ -233,7 +233,7 @@ func (peer *Peer) getAccepted(rfList []bgp.RouteFamily) []*table.Path { return peer.adjRibIn.PathList(rfList, true) } -func (peer *Peer) filterpath(path *table.Path, withdrawals []*table.Path) *table.Path { +func (peer *Peer) filterpath(path, old *table.Path) *table.Path { // special handling for RTC nlri // see comments in (*Destination).Calculate() if path != nil && path.GetRouteFamily() == bgp.RF_RTC_UC && !path.IsWithdraw { @@ -268,7 +268,7 @@ func (peer *Peer) filterpath(path *table.Path, withdrawals []*table.Path) *table } } - if path = filterpath(peer, path, withdrawals); path == nil { + if path = filterpath(peer, path, old); path == nil { return nil } @@ -324,7 +324,7 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* return pathList, filtered } -func (peer *Peer) processOutgoingPaths(paths, withdrawals []*table.Path) []*table.Path { +func (peer *Peer) processOutgoingPaths(paths, olds []*table.Path) []*table.Path { if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED { return nil } @@ -338,8 +338,12 @@ func (peer *Peer) processOutgoingPaths(paths, withdrawals []*table.Path) []*tabl outgoing := make([]*table.Path, 0, len(paths)) - for _, path := range paths { - if p := peer.filterpath(path, withdrawals); p != nil { + for idx, path := range paths { + var old *table.Path + if olds != nil { + old = olds[idx] + } + if p := peer.filterpath(path, old); p != nil { outgoing = append(outgoing, p) } } |