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/server.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/server.go')
-rw-r--r-- | server/server.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/server/server.go b/server/server.go index 263bc00c..e97fd7f6 100644 --- a/server/server.go +++ b/server/server.go @@ -269,7 +269,7 @@ func isASLoop(peer *Peer, path *table.Path) bool { return false } -func filterpath(peer *Peer, path *table.Path, withdrawals []*table.Path) *table.Path { +func filterpath(peer *Peer, path, old *table.Path) *table.Path { if path == nil { return nil } @@ -377,10 +377,8 @@ func filterpath(peer *Peer, path *table.Path, withdrawals []*table.Path) *table. // the withdrawal path. // Thing is same when peer A and we advertized prefix P (as local // route), then, we withdraws the prefix. - for _, w := range withdrawals { - if path.GetNlri().String() == w.GetNlri().String() { - return w - } + if old != nil { + return old.Clone(true) } } log.WithFields(log.Fields{ @@ -512,8 +510,8 @@ func (server *BgpServer) RSimportPaths(peer *Peer, pathList []*table.Path) []*ta func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) []*table.Path { rib := server.globalRib - var alteredPathList, withdrawn []*table.Path - var best map[string][]*table.Path + var alteredPathList []*table.Path + var best, old map[string][]*table.Path if peer != nil && peer.fsm.pConf.Config.Vrf != "" { vrf := server.globalRib.Vrfs[peer.fsm.pConf.Config.Vrf] @@ -544,7 +542,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) []* ids = append(ids, targetPeer.TableID()) } } - best, withdrawn, _ = rib.ProcessPaths(ids, append(pathList, moded...)) + best, old, _ = rib.ProcessPaths(ids, append(pathList, moded...)) } else { for idx, path := range pathList { path = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_IMPORT, path, nil) @@ -596,7 +594,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) []* } alteredPathList = pathList var multipath [][]*table.Path - best, withdrawn, multipath = rib.ProcessPaths([]string{table.GLOBAL_RIB_NAME}, pathList) + best, old, multipath = rib.ProcessPaths([]string{table.GLOBAL_RIB_NAME}, pathList) if len(best[table.GLOBAL_RIB_NAME]) == 0 { return alteredPathList } @@ -607,7 +605,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) []* if (peer == nil && targetPeer.isRouteServerClient()) || (peer != nil && peer.isRouteServerClient() != targetPeer.isRouteServerClient()) { continue } - if paths := targetPeer.processOutgoingPaths(best[targetPeer.TableID()], withdrawn); len(paths) > 0 { + if paths := targetPeer.processOutgoingPaths(best[targetPeer.TableID()], old[targetPeer.TableID()]); len(paths) > 0 { sendFsmOutgoingMsg(targetPeer, paths, nil, false) } } |