diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-04-11 21:45:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-07 21:18:04 +0900 |
commit | 6110fad59441454c8a6f534874ae29b770098b73 (patch) | |
tree | 6722d3ab737b71cf90340ce7c598398314770fac /table | |
parent | 957917651e48e552491d9a6272db296cb5c0a295 (diff) |
avoid updating Path in the rib via MarkStale()
A path object in the adj-in is also in the master rib. We can't update
such.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/adj.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/table/adj.go b/table/adj.go index d16f8d76..68e79d17 100644 --- a/table/adj.go +++ b/table/adj.go @@ -127,14 +127,23 @@ func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { return pathList } -func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) { +func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) []*Path { + pathList := make([]*Path, 0) for _, rf := range rfList { if table, ok := adj.table[rf]; ok { - for _, p := range table { - p.MarkStale(true) + l := make([]*Path, 0, len(table)) + for k, p := range table { + n := p.Clone(false) + n.MarkStale(true) + table[k] = n + l = append(l, n) + } + if len(l) > 0 { + pathList = append(pathList, l...) } } } + return pathList } func (adj *AdjRib) Exists(path *Path) bool { |