diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-06 14:19:43 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-06 15:07:36 -0800 |
commit | d280168106c9ef9ed68ad117b913f52e6bae1827 (patch) | |
tree | 37d67be13c26c19a366e2c1d5621eff74a8984b4 /table/table_manager.go | |
parent | fa6c8fe58b7ef9aca401262be8677bb4526c3fcd (diff) |
add route collector feature support
like openbgp's route collector, sends all updates (not only best).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r-- | table/table_manager.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/table/table_manager.go b/table/table_manager.go index f21acef0..ebfd0beb 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -276,7 +276,7 @@ func (manager *TableManager) handleMacMobility(path *Path) []*Destination { if path.IsWithdraw || path.IsLocal() || nlri.RouteType != bgp.EVPN_ROUTE_TYPE_MAC_IP_ADVERTISEMENT { return nil } - for _, path2 := range manager.GetPathList(GLOBAL_RIB_NAME, bgp.RF_EVPN) { + for _, path2 := range manager.GetPathList(GLOBAL_RIB_NAME, []bgp.RouteFamily{bgp.RF_EVPN}) { if !path2.IsLocal() || path2.GetNlri().(*bgp.EVPNNLRI).RouteType != bgp.EVPN_ROUTE_TYPE_MAC_IP_ADVERTISEMENT { continue } @@ -323,9 +323,18 @@ func (manager *TableManager) GetBestPathList(id string, rfList []bgp.RouteFamily return paths } -func (manager *TableManager) GetPathList(id string, rf bgp.RouteFamily) []*Path { - if t, ok := manager.Tables[rf]; ok { - return t.GetKnownPathList(id) +func (manager *TableManager) GetPathList(id string, rfList []bgp.RouteFamily) []*Path { + c := 0 + for _, rf := range rfList { + if t, ok := manager.Tables[rf]; ok { + c += len(t.destinations) + } } - return nil + paths := make([]*Path, 0, c) + for _, rf := range rfList { + if t, ok := manager.Tables[rf]; ok { + paths = append(paths, t.GetKnownPathList(id)...) + } + } + return paths } |