summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table/adj.go
diff options
context:
space:
mode:
authorMagesh GV <mageshgv@gmail.com>2019-09-30 10:36:54 -0700
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-02 20:45:44 +0900
commit6f3cb401644fcba0353ac06de261dd40100daa84 (patch)
tree0602d523c17bccf5ebf5ee15eb8c5c07bd19d39a /internal/pkg/table/adj.go
parent93beafeec5ec667602afe506f2692db81344d5a7 (diff)
Update adjrib for LLGR and preserve aslooped attr
Fixes LLGR community cleared on softreset. Fixes AS Path looped routes added back to rib on Graceful Restart.
Diffstat (limited to 'internal/pkg/table/adj.go')
-rw-r--r--internal/pkg/table/adj.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/internal/pkg/table/adj.go b/internal/pkg/table/adj.go
index 4b9d7c5f..d63537f8 100644
--- a/internal/pkg/table/adj.go
+++ b/internal/pkg/table/adj.go
@@ -173,11 +173,39 @@ func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) []*Path {
for i, p := range d.knownPathList {
n := p.Clone(false)
n.MarkStale(true)
+ n.SetAsLooped(p.IsAsLooped())
d.knownPathList[i] = n
- pathList = append(pathList, n)
+ if !n.IsAsLooped() {
+ pathList = append(pathList, n)
+ }
+ }
+ return false
+ })
+ return pathList
+}
+
+func (adj *AdjRib) MarkLLGRStaleOrDrop(rfList []bgp.RouteFamily) []*Path {
+ pathList := make([]*Path, 0, adj.Count(rfList))
+ adj.walk(rfList, func(d *Destination) bool {
+ for i, p := range d.knownPathList {
+ if p.HasNoLLGR() {
+ n := p.Clone(true)
+ n.SetDropped(true)
+ pathList = append(pathList, n)
+ } else {
+ n := p.Clone(false)
+ n.SetAsLooped(p.IsAsLooped())
+ n.SetCommunities([]uint32{uint32(bgp.COMMUNITY_LLGR_STALE)}, false)
+ if p.IsAsLooped() {
+ d.knownPathList[i] = n
+ } else {
+ pathList = append(pathList, n)
+ }
+ }
}
return false
})
+ adj.Update(pathList)
return pathList
}