diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-02-10 23:41:44 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-10 23:41:44 -0800 |
commit | 023a498e4a90982095c870c5491770bf4952fc2b (patch) | |
tree | 135c11a05d8ff106264d91f0965aa6d926ac861b /table/adj.go | |
parent | b19bbd415e8d33f01bcd407baece94ea1b81c957 (diff) |
server: support graceful-restart helper-speaker behavior
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/adj.go')
-rw-r--r-- | table/adj.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/table/adj.go b/table/adj.go index 77660fab..411f74f0 100644 --- a/table/adj.go +++ b/table/adj.go @@ -133,3 +133,31 @@ func (adj *AdjRib) Drop(rfList []bgp.RouteFamily) { } } } + +func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { + pathList := make([]*Path, 0, adj.Count(rfList)) + for _, rf := range rfList { + if table, ok := adj.table[rf]; ok { + for _, p := range table { + if p.IsStale() { + delete(table, p.getPrefix()) + if p.Filtered(adj.id) == POLICY_DIRECTION_NONE { + adj.accepted[rf]-- + } + pathList = append(pathList, p.Clone(true)) + } + } + } + } + return pathList +} + +func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) { + for _, rf := range rfList { + if table, ok := adj.table[rf]; ok { + for _, p := range table { + p.MarkStale(true) + } + } + } +} |