diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-14 08:41:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-14 08:41:29 +0900 |
commit | f9a997b6b26ae5084c3e1e36bd1638be9166046a (patch) | |
tree | 60ded15f3c77c081bb030d3c6a204adec0a78940 /table | |
parent | 3b6fe71343ab742dfdea5aab8cdcb47b6652e096 (diff) |
server: don't path information if path include the same AS number
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/path.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/table/path.go b/table/path.go index 0d52d343..ffbdd902 100644 --- a/table/path.go +++ b/table/path.go @@ -34,6 +34,7 @@ type Path interface { updatePathAttrs(global *config.Global, peer *config.Neighbor) GetRouteFamily() bgp.RouteFamily GetAsPathLen() int + GetAsList() []uint32 setSource(source *PeerInfo) GetSource() *PeerInfo GetSourceAs() uint32 @@ -361,6 +362,19 @@ func (pd *PathDefault) GetAsPathLen() int { return length } +func (pd *PathDefault) GetAsList() []uint32 { + asList := []uint32{} + if _, attr := pd.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH); attr != nil { + aspath := attr.(*bgp.PathAttributeAsPath) + for _, paramIf := range aspath.Value { + segment := paramIf.(*bgp.As4PathParam) + asList = append(asList, segment.AS...) + } + + } + return asList +} + // create Path object based on route family func CreatePath(source *PeerInfo, nlri bgp.AddrPrefixInterface, attrs []bgp.PathAttributeInterface, isWithdraw bool, now time.Time) (Path, error) { |