diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-20 21:25:03 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-26 07:02:54 +0900 |
commit | 2e05695f683430bdf39573b19f51bac4dcbbc693 (patch) | |
tree | 3f80939fb737832dbf8f8f5ebe0b35e0e9900718 /internal | |
parent | b4e2d9e440a4eb6d3091a7c586d2e55b69ec968a (diff) |
avoid installing routes with originator ID to global when softresetin
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/config/util.go | 1 | ||||
-rw-r--r-- | internal/pkg/table/adj.go | 18 | ||||
-rw-r--r-- | internal/pkg/table/adj_test.go | 6 | ||||
-rw-r--r-- | internal/pkg/table/path.go | 10 |
4 files changed, 18 insertions, 17 deletions
diff --git a/internal/pkg/config/util.go b/internal/pkg/config/util.go index 228c9e3d..522129a3 100644 --- a/internal/pkg/config/util.go +++ b/internal/pkg/config/util.go @@ -225,6 +225,7 @@ func (n *Neighbor) NeedsResendOpenMessage(new *Neighbor) bool { return !n.Config.Equal(&new.Config) || !n.Transport.Config.Equal(&new.Transport.Config) || !n.AddPaths.Config.Equal(&new.AddPaths.Config) || + !n.AsPathOptions.Config.Equal(&new.AsPathOptions.Config) || !n.GracefulRestart.Config.Equal(&new.GracefulRestart.Config) || isAfiSafiChanged(n.AfiSafis, new.AfiSafis) } diff --git a/internal/pkg/table/adj.go b/internal/pkg/table/adj.go index 5dda2a29..aedc41d6 100644 --- a/internal/pkg/table/adj.go +++ b/internal/pkg/table/adj.go @@ -63,16 +63,16 @@ func (adj *AdjRib) Update(pathList []*Path) { if len(d.knownPathList) == 0 { t.deleteDest(d) } - if !old.IsAsLooped() { + if !old.IsRejected() { adj.accepted[rf]-- } } path.SetDropped(true) } else { if idx != -1 { - if old.IsAsLooped() && !path.IsAsLooped() { + if old.IsRejected() && !path.IsRejected() { adj.accepted[rf]++ - } else if !old.IsAsLooped() && path.IsAsLooped() { + } else if !old.IsRejected() && path.IsRejected() { adj.accepted[rf]-- } if old.Equal(path) { @@ -81,7 +81,7 @@ func (adj *AdjRib) Update(pathList []*Path) { d.knownPathList[idx] = path } else { d.knownPathList = append(d.knownPathList, path) - if !path.IsAsLooped() { + if !path.IsRejected() { adj.accepted[rf]++ } } @@ -121,7 +121,7 @@ func (adj *AdjRib) PathList(rfList []bgp.RouteFamily, accepted bool) []*Path { pathList := make([]*Path, 0, adj.Count(rfList)) adj.walk(rfList, func(d *Destination) bool { for _, p := range d.knownPathList { - if accepted && p.IsAsLooped() { + if accepted && p.IsRejected() { continue } pathList = append(pathList, p) @@ -189,9 +189,9 @@ 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()) + n.SetRejected(p.IsRejected()) d.knownPathList[i] = n - if !n.IsAsLooped() { + if !n.IsRejected() { pathList = append(pathList, n) } } @@ -210,9 +210,9 @@ func (adj *AdjRib) MarkLLGRStaleOrDrop(rfList []bgp.RouteFamily) []*Path { pathList = append(pathList, n) } else { n := p.Clone(false) - n.SetAsLooped(p.IsAsLooped()) + n.SetRejected(p.IsRejected()) n.SetCommunities([]uint32{uint32(bgp.COMMUNITY_LLGR_STALE)}, false) - if p.IsAsLooped() { + if p.IsRejected() { d.knownPathList[i] = n } else { pathList = append(pathList, n) diff --git a/internal/pkg/table/adj_test.go b/internal/pkg/table/adj_test.go index bb1f07b9..3ae59465 100644 --- a/internal/pkg/table/adj_test.go +++ b/internal/pkg/table/adj_test.go @@ -98,7 +98,7 @@ func TestStale(t *testing.T) { p1 := NewPath(pi, nlri1, false, attrs, time.Now(), false) nlri2 := bgp.NewIPAddrPrefix(24, "20.20.20.0") p2 := NewPath(pi, nlri2, false, attrs, time.Now(), false) - p2.SetAsLooped(true) + p2.SetRejected(true) family := p1.GetRouteFamily() families := []bgp.RouteFamily{family} @@ -135,11 +135,11 @@ func TestLLGRStale(t *testing.T) { nlri2 := bgp.NewIPAddrPrefix(24, "20.20.20.0") p2 := NewPath(pi, nlri2, false, attrs, time.Now(), false) - p2.SetAsLooped(true) // Not accepted + p2.SetRejected(true) // Not accepted nlri3 := bgp.NewIPAddrPrefix(24, "20.20.30.0") p3 := NewPath(pi, nlri3, false, attrs, time.Now(), false) - p3.SetAsLooped(true) + p3.SetRejected(true) // Not accepted and then dropped on MarkLLGRStaleOrDrop p3.SetCommunities([]uint32{uint32(bgp.COMMUNITY_NO_LLGR)}, false) diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go index 0a6debca..805fa63c 100644 --- a/internal/pkg/table/path.go +++ b/internal/pkg/table/path.go @@ -137,7 +137,7 @@ type Path struct { pathAttrs []bgp.PathAttributeInterface dels []bgp.BGPAttrType attrsHash uint32 - aslooped bool + rejected bool // doesn't exist in the adj dropped bool @@ -382,12 +382,12 @@ func (path *Path) IsStale() bool { return path.OriginInfo().stale } -func (path *Path) IsAsLooped() bool { - return path.aslooped +func (path *Path) IsRejected() bool { + return path.rejected } -func (path *Path) SetAsLooped(y bool) { - path.aslooped = y +func (path *Path) SetRejected(y bool) { + path.rejected = y } func (path *Path) IsDropped() bool { |