diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-25 10:28:50 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-26 08:09:02 +0900 |
commit | 0730e0f9dd6a00a89da85df29fd7db18a1e0f857 (patch) | |
tree | 4398855e4069508ec1bc82ea7c6f39034bd0215d /table/destination.go | |
parent | b53944902472a3442f4a0c073458e773da019723 (diff) |
add addpath send support
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/table/destination.go b/table/destination.go index 78e0ac6b..c465e9f8 100644 --- a/table/destination.go +++ b/table/destination.go @@ -228,6 +228,17 @@ func (dd *Destination) GetMultiBestPath(id string) []*Path { return getMultiBestPath(id, &dd.knownPathList) } +func (dd *Destination) GetAddPathChanges(id string) []*Path { + l := make([]*Path, 0, len(dd.newPathList)+len(dd.withdrawList)) + for _, p := range dd.newPathList { + l = append(l, p) + } + for _, p := range dd.withdrawList { + l = append(l, p.Clone(true)) + } + return l +} + func (dd *Destination) GetChanges(id string, peerDown bool) (*Path, *Path, []*Path) { best, old := func(id string) (*Path, *Path) { old := getBestPath(id, &dd.oldKnownPathList) @@ -318,6 +329,7 @@ func (dd *Destination) validatePath(path *Path) { // paths from known paths. Also, adds new paths to known paths. func (dest *Destination) Calculate() *Destination { oldKnownPathList := dest.knownPathList + newPathList := dest.newPathList // First remove the withdrawn paths. withdrawn := dest.explicitWithdraw() // Do implicit withdrawal @@ -346,6 +358,8 @@ func (dest *Destination) Calculate() *Destination { nlri: dest.nlri, knownPathList: dest.knownPathList, oldKnownPathList: oldKnownPathList, + newPathList: newPathList, + withdrawList: withdrawn, } } |