diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-04-10 22:24:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-07 21:18:04 +0900 |
commit | 2dbca9e29a6813f2df53261ffaa59b9439c13fdd (patch) | |
tree | 8303b71da5741ffb592bc74738b6548d078a0253 /table/table_manager.go | |
parent | 756cc9162afb675dd7ca159b6f07a6d5b927bcc1 (diff) |
use sorted single master table for route server setup
https://github.com/osrg/gobgp/issues/1249
The IN policy was removed. The modification by the IMPORT policy are
visible to all route server peers.
This saves some dozens bytes memory per a path.
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 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/table/table_manager.go b/table/table_manager.go index 7341df17..0e980404 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -255,7 +255,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.RouteFamily{bgp.RF_EVPN}) { + for _, path2 := range manager.GetPathList(GLOBAL_RIB_NAME, 0, []bgp.RouteFamily{bgp.RF_EVPN}) { if !path2.IsLocal() || path2.GetNlri().(*bgp.EVPNNLRI).RouteType != bgp.EVPN_ROUTE_TYPE_MAC_IP_ADVERTISEMENT { continue } @@ -307,14 +307,14 @@ func (manager *TableManager) getDestinationCount(rfList []bgp.RouteFamily) int { return count } -func (manager *TableManager) GetBestPathList(id string, rfList []bgp.RouteFamily) []*Path { +func (manager *TableManager) GetBestPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path { if SelectionOptions.DisableBestPathSelection { // Note: If best path selection disabled, there is no best path. return nil } paths := make([]*Path, 0, manager.getDestinationCount(rfList)) for _, t := range manager.tables(rfList...) { - paths = append(paths, t.Bests(id)...) + paths = append(paths, t.Bests(id, as)...) } return paths } @@ -332,10 +332,10 @@ func (manager *TableManager) GetBestMultiPathList(id string, rfList []bgp.RouteF return paths } -func (manager *TableManager) GetPathList(id string, rfList []bgp.RouteFamily) []*Path { +func (manager *TableManager) GetPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path { paths := make([]*Path, 0, manager.getDestinationCount(rfList)) for _, t := range manager.tables(rfList...) { - paths = append(paths, t.GetKnownPathList(id)...) + paths = append(paths, t.GetKnownPathList(id, as)...) } return paths } @@ -344,7 +344,7 @@ func (manager *TableManager) GetPathListWithNexthop(id string, rfList []bgp.Rout paths := make([]*Path, 0, manager.getDestinationCount(rfList)) for _, rf := range rfList { if t, ok := manager.Tables[rf]; ok { - for _, path := range t.GetKnownPathList(id) { + for _, path := range t.GetKnownPathList(id, 0) { if path.GetNexthop().Equal(nexthop) { paths = append(paths, path) } @@ -366,10 +366,10 @@ func (manager *TableManager) GetDestination(path *Path) *Destination { return t.GetDestination(path.getPrefix()) } -func (manager *TableManager) TableInfo(id string, family bgp.RouteFamily) (*TableInfo, error) { +func (manager *TableManager) TableInfo(id string, as uint32, family bgp.RouteFamily) (*TableInfo, error) { t, ok := manager.Tables[family] if !ok { return nil, fmt.Errorf("address family %s is not configured", family) } - return t.Info(id), nil + return t.Info(id, as), nil } |