summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-04-12 22:40:27 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-04-12 22:40:27 +0900
commit284ef3627d48bfa22afc4228c8f9cfdec737150e (patch)
tree17eb6a5d11b394131d383924760bf07613c6a7b2 /internal/pkg/table
parent0942793b79fb0ba2f9c5f3b1c79c489ad59c98b9 (diff)
table: delete unused reason in Path struct
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal/pkg/table')
-rw-r--r--internal/pkg/table/destination.go13
-rw-r--r--internal/pkg/table/path.go1
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