diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-13 23:28:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-13 23:28:29 +0900 |
commit | 529bec9f5c907bb9b93c6e5c7287b6985ff1ee03 (patch) | |
tree | 159e4b5b013a49139a169ad2e61d47c0ae930119 /table/destination.go | |
parent | 78ec2585b7f8c1cb4f20d9c0283b3251b30669d3 (diff) |
table: fix best path presentation
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/table/destination.go b/table/destination.go index f6ee4030..e602deb0 100644 --- a/table/destination.go +++ b/table/destination.go @@ -96,6 +96,13 @@ func NewDestinationDefault(nlri bgp.AddrPrefixInterface) *DestinationDefault { func (dd *DestinationDefault) MarshalJSON() ([]byte, error) { prefix := dd.getNlri().(*bgp.NLRInfo).Prefix + for _, p := range dd.knownPathList { + if p == dd.getBestPath() { + p.setBest(true) + } else { + p.setBest(false) + } + } return json.Marshal(struct { Prefix string Paths []Path @@ -135,9 +142,6 @@ func (dd *DestinationDefault) getBestPath() Path { func (dd *DestinationDefault) setBestPath(path Path) { dd.bestPath = path - if path != nil { - path.setBest(true) - } } func (dd *DestinationDefault) getOldBestPath() Path { @@ -146,9 +150,6 @@ func (dd *DestinationDefault) getOldBestPath() Path { func (dd *DestinationDefault) setOldBestPath(path Path) { dd.oldBestPath = path - if path != nil { - path.setBest(false) - } } func (dd *DestinationDefault) getKnownPathList() []Path { |