summaryrefslogtreecommitdiffhomepage
path: root/table/destination.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/destination.go')
-rw-r--r--table/destination.go13
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 {