diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-26 10:26:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-26 10:26:07 +0900 |
commit | 5856fe44297cb4248356671bc7a7f9c3bf17b699 (patch) | |
tree | 7a296d2057b0bbc03467e6417a3db20950281ef0 /internal/pkg | |
parent | a472a4964087989814740ac175d12b2759394c85 (diff) |
table: kill GetPathListByPeer()
when a peer is down, use paths in its adj table instead of searching
for the global table.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal/pkg')
-rw-r--r-- | internal/pkg/table/adj.go | 7 | ||||
-rw-r--r-- | internal/pkg/table/table_manager.go | 15 |
2 files changed, 6 insertions, 16 deletions
diff --git a/internal/pkg/table/adj.go b/internal/pkg/table/adj.go index 95fbf6af..acb2c07b 100644 --- a/internal/pkg/table/adj.go +++ b/internal/pkg/table/adj.go @@ -106,13 +106,18 @@ func (adj *AdjRib) Accepted(rfList []bgp.RouteFamily) int { return count } -func (adj *AdjRib) Drop(rfList []bgp.RouteFamily) { +func (adj *AdjRib) Drop(rfList []bgp.RouteFamily) []*Path { + l := make([]*Path, 0, adj.Count(rfList)) for _, rf := range rfList { if _, ok := adj.table[rf]; ok { + for _, p := range adj.table[rf] { + l = append(l, p.Clone(true)) + } adj.table[rf] = make(map[string]*Path) adj.accepted[rf] = 0 } } + return l } func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { diff --git a/internal/pkg/table/table_manager.go b/internal/pkg/table/table_manager.go index 57533322..55436369 100644 --- a/internal/pkg/table/table_manager.go +++ b/internal/pkg/table/table_manager.go @@ -190,21 +190,6 @@ func (tm *TableManager) update(newPath *Path) *Update { return u } -func (manager *TableManager) GetPathListByPeer(info *PeerInfo, rf bgp.RouteFamily) []*Path { - if t, ok := manager.Tables[rf]; ok { - pathList := make([]*Path, 0, len(t.destinations)) - for _, dst := range t.destinations { - for _, p := range dst.knownPathList { - if p.GetSource().Equal(info) { - pathList = append(pathList, p) - } - } - } - return pathList - } - return nil -} - func (manager *TableManager) Update(newPath *Path) []*Update { if newPath == nil || newPath.IsEOR() { return nil |