From 6110fad59441454c8a6f534874ae29b770098b73 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 11 Apr 2018 21:45:54 +0900 Subject: 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 --- table/adj.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'table') 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 { -- cgit v1.2.3