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/adj.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/adj.go')
-rw-r--r-- | table/adj.go | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/table/adj.go b/table/adj.go index 98c714e6..d16f8d76 100644 --- a/table/adj.go +++ b/table/adj.go @@ -51,23 +51,12 @@ func (adj *AdjRib) Update(pathList []*Path) { if path.IsWithdraw { if found { delete(adj.table[rf], key) - if old.Filtered(adj.id) != POLICY_DIRECTION_IN { - adj.accepted[rf]-- - } + adj.accepted[rf]-- } } else { - n := path.Filtered(adj.id) if found { - o := old.Filtered(adj.id) - if o == POLICY_DIRECTION_IN && n == POLICY_DIRECTION_NONE { - adj.accepted[rf]++ - } else if o != POLICY_DIRECTION_IN && n == POLICY_DIRECTION_IN { - adj.accepted[rf]-- - } } else { - if n == POLICY_DIRECTION_NONE { - adj.accepted[rf]++ - } + adj.accepted[rf]++ } if found && old.Equal(path) { path.setTimestamp(old.GetTimestamp()) @@ -79,12 +68,7 @@ func (adj *AdjRib) Update(pathList []*Path) { func (adj *AdjRib) RefreshAcceptedNumber(rfList []bgp.RouteFamily) { for _, rf := range rfList { - adj.accepted[rf] = 0 - for _, p := range adj.table[rf] { - if p.Filtered(adj.id) != POLICY_DIRECTION_IN { - adj.accepted[rf]++ - } - } + adj.accepted[rf] = len(adj.table[rf]) } } @@ -92,9 +76,6 @@ func (adj *AdjRib) PathList(rfList []bgp.RouteFamily, accepted bool) []*Path { pathList := make([]*Path, 0, adj.Count(rfList)) for _, rf := range rfList { for _, rr := range adj.table[rf] { - if accepted && rr.Filtered(adj.id) == POLICY_DIRECTION_IN { - continue - } pathList = append(pathList, rr) } } @@ -137,9 +118,7 @@ func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { for _, p := range table { if p.IsStale() { delete(table, p.getPrefix()) - if p.Filtered(adj.id) == POLICY_DIRECTION_NONE { - adj.accepted[rf]-- - } + adj.accepted[rf]-- pathList = append(pathList, p.Clone(true)) } } |