diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-04-12 22:40:27 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-04-12 22:40:27 +0900 |
commit | 284ef3627d48bfa22afc4228c8f9cfdec737150e (patch) | |
tree | 17eb6a5d11b394131d383924760bf07613c6a7b2 | |
parent | 0942793b79fb0ba2f9c5f3b1c79c489ad59c98b9 (diff) |
table: delete unused reason in Path struct
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r-- | internal/pkg/table/destination.go | 13 | ||||
-rw-r--r-- | internal/pkg/table/path.go | 1 |
2 files changed, 6 insertions, 8 deletions
diff --git a/internal/pkg/table/destination.go b/internal/pkg/table/destination.go index 44686abe..2cb902e1 100644 --- a/internal/pkg/table/destination.go +++ b/internal/pkg/table/destination.go @@ -405,17 +405,19 @@ func (dest *Destination) computeKnownBestPath() (*Path, BestPathReason, error) { } return dest.knownPathList[0], BPR_ONLY_PATH, nil } - dest.sort() + reason := dest.sort() newBest := dest.knownPathList[0] // If the first path has the invalidated next-hop, which evaluated by IGP, // returns no path with the reason of the next-hop reachability. if dest.knownPathList[0].IsNexthopInvalid { return nil, BPR_REACHABLE_NEXT_HOP, nil } - return newBest, newBest.reason, nil + return newBest, reason, nil } -func (dst *Destination) sort() { +func (dst *Destination) sort() BestPathReason { + reason := BPR_UNKNOWN + sort.SliceStable(dst.knownPathList, func(i, j int) bool { //Compares given paths and returns best path. // @@ -451,7 +453,6 @@ func (dst *Destination) sort() { path2 := dst.knownPathList[j] var better *Path - reason := BPR_UNKNOWN // draft-uttaro-idr-bgp-persistence-02 if better == nil { @@ -515,11 +516,9 @@ func (dst *Destination) sort() { reason = BPR_UNKNOWN better = path1 } - - better.reason = reason - return better == path1 }) + return reason } type Update struct { diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go index 92aec66f..94925a9f 100644 --- a/internal/pkg/table/path.go +++ b/internal/pkg/table/path.go @@ -139,7 +139,6 @@ type Path struct { dels []bgp.BGPAttrType attrsHash uint32 aslooped bool - reason BestPathReason // For BGP Nexthop Tracking, this field shows if nexthop is invalidated by IGP. IsNexthopInvalid bool |