diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-10-09 07:18:13 -0700 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-10-09 07:18:13 -0700 |
commit | 614746ca1159fe421047df04c5af6f07c38b2e65 (patch) | |
tree | 77e93a40ec38318a96ab3a195fb1baa68372acd2 /table/destination.go | |
parent | 6b6f6974fcea37dc006f90dbd2f8d65495048725 (diff) |
*: support long lived graceful restart
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/table/destination.go b/table/destination.go index 58991a35..50b946e9 100644 --- a/table/destination.go +++ b/table/destination.go @@ -47,6 +47,7 @@ const ( BPR_IGP_COST BestPathReason = "IGP Cost" BPR_ROUTER_ID BestPathReason = "Router ID" BPR_OLDER BestPathReason = "Older" + BPR_NON_LLGR_STALE BestPathReason = "no LLGR Stale" ) func IpToRadixkey(b []byte, max uint8) string { @@ -479,6 +480,11 @@ func (p paths) Less(i, j int) bool { var better *Path reason := BPR_UNKNOWN + // draft-uttaro-idr-bgp-persistence-02 + if better == nil { + better = compareByLLGRStaleCommunity(path1, path2) + reason = BPR_NON_LLGR_STALE + } // Follow best path calculation algorithm steps. // compare by reachability if better == nil { @@ -545,6 +551,17 @@ func (p paths) Less(i, j int) bool { return false } +func compareByLLGRStaleCommunity(path1, path2 *Path) *Path { + p1 := path1.IsLLGRStale() + p2 := path2.IsLLGRStale() + if p1 == p2 { + return nil + } else if p1 { + return path2 + } + return path1 +} + func compareByReachableNexthop(path1, path2 *Path) *Path { // Compares given paths and selects best path based on reachable next-hop. // |