diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-24 07:17:04 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-24 08:08:17 +0900 |
commit | bbd98ee21154f832896c7a39468eeb50edd0e527 (patch) | |
tree | 1655e6aa008001732498cdff403ef7f4017f097d /table/destination.go | |
parent | 87245b488bedca33b766ccd967636946416587cc (diff) |
fix withdraw with addpath and rtc enabled
Needs withdrawn paths that includes attributes. The attributes are
necessary because they are used with rtc table to check if the paths
were sent.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/table/destination.go b/table/destination.go index adf1c0cd..a37d2114 100644 --- a/table/destination.go +++ b/table/destination.go @@ -558,6 +558,29 @@ func getMultiBestPath(id string, pathList []*Path) []*Path { return list } +func (u *Update) GetWithdrawnPath() []*Path { + if len(u.KnownPathList) == len(u.OldKnownPathList) { + return nil + } + + l := make([]*Path, 0, len(u.OldKnownPathList)) + + for _, p := range u.OldKnownPathList { + y := func() bool { + for _, old := range u.KnownPathList { + if p == old { + return true + } + } + return false + }() + if !y { + l = append(l, p.Clone(true)) + } + } + return l +} + func (u *Update) GetChanges(id string, as uint32, peerDown bool) (*Path, *Path, []*Path) { best, old := func(id string) (*Path, *Path) { old := getBestPath(id, as, u.OldKnownPathList) |