diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-05-21 15:00:41 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-05-23 09:46:53 +0900 |
commit | a7521827e1d8c964f1c9f342dc39d02f45660c49 (patch) | |
tree | ce40585522e52bc881c7640f95c25961948342f1 /table | |
parent | 31342564c9e7a78a183f11dd637e36c08e0f274b (diff) |
server/table: fix intra-AS RTC route distribution
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/adj.go | 13 | ||||
-rw-r--r-- | table/destination.go | 8 | ||||
-rw-r--r-- | table/table_manager.go | 12 |
3 files changed, 33 insertions, 0 deletions
diff --git a/table/adj.go b/table/adj.go index 5e685f2e..8aa40370 100644 --- a/table/adj.go +++ b/table/adj.go @@ -156,3 +156,16 @@ func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) { } } } + +func (adj *AdjRib) Exists(path *Path) bool { + if path == nil { + return false + } + family := path.GetRouteFamily() + table, ok := adj.table[family] + if !ok { + return false + } + _, ok = table[path.getPrefix()] + return ok +} diff --git a/table/destination.go b/table/destination.go index 91d2d89b..e02c7686 100644 --- a/table/destination.go +++ b/table/destination.go @@ -254,6 +254,14 @@ func (dest *Destination) Calculate(ids []string) (map[string]*Path, []*Path) { }() best := dest.GetBestPath(id) if best != nil && best.Equal(old) { + // RFC4684 3.2. Intra-AS VPN Route Distribution + // When processing RT membership NLRIs received from internal iBGP + // peers, it is necessary to consider all available iBGP paths for a + // given RT prefix, for building the outbound route filter, and not just + // the best path. + if best.GetRouteFamily() == bgp.RF_RTC_UC { + return best + } return nil } if best == nil { diff --git a/table/table_manager.go b/table/table_manager.go index a041c5b9..cc9784b9 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -358,3 +358,15 @@ func (manager *TableManager) GetPathList(id string, rfList []bgp.RouteFamily) [] } return paths } + +func (manager *TableManager) GetDestination(path *Path) *Destination { + if path == nil { + return nil + } + family := path.GetRouteFamily() + t, ok := manager.Tables[family] + if !ok { + return nil + } + return t.GetDestination(path.getPrefix()) +} |