summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-20 21:25:03 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-26 07:02:54 +0900
commit2e05695f683430bdf39573b19f51bac4dcbbc693 (patch)
tree3f80939fb737832dbf8f8f5ebe0b35e0e9900718 /pkg
parentb4e2d9e440a4eb6d3091a7c586d2e55b69ec968a (diff)
avoid installing routes with originator ID to global when softresetin
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/server/peer.go3
-rw-r--r--pkg/server/server.go30
2 files changed, 3 insertions, 30 deletions
diff --git a/pkg/server/peer.go b/pkg/server/peer.go
index c213a9ea..a3f2be7b 100644
--- a/pkg/server/peer.go
+++ b/pkg/server/peer.go
@@ -481,7 +481,7 @@ func (peer *peer) handleUpdate(e *fsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg
allowOwnAS := int(peer.fsm.pConf.AsPathOptions.Config.AllowOwnAs)
peer.fsm.lock.RUnlock()
if hasOwnASLoop(localAS, allowOwnAS, aspath) {
- path.SetAsLooped(true)
+ path.SetRejected(true)
continue
}
}
@@ -500,6 +500,7 @@ func (peer *peer) handleUpdate(e *fsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg
"OriginatorID": id,
"Data": path,
}).Debug("Originator ID is mine, ignore")
+ path.SetRejected(true)
continue
}
}
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 2312b39d..f95a988c 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -2255,34 +2255,7 @@ func (s *BgpServer) softResetIn(addr string, family bgp.RouteFamily) error {
return err
}
for _, peer := range peers {
- families := familiesForSoftreset(peer, family)
-
- pathList := make([]*table.Path, 0, peer.adjRibIn.Count(families))
- for _, path := range peer.adjRibIn.PathList(families, false) {
- // RFC4271 9.1.2 Phase 2: Route Selection
- //
- // If the AS_PATH attribute of a BGP route contains an AS loop, the BGP
- // route should be excluded from the Phase 2 decision function.
- isLooped := false
- if aspath := path.GetAsPath(); aspath != nil {
- peer.fsm.lock.RLock()
- localAS := peer.fsm.peerInfo.LocalAS
- allowOwnAS := int(peer.fsm.pConf.AsPathOptions.Config.AllowOwnAs)
- peer.fsm.lock.RUnlock()
- isLooped = hasOwnASLoop(localAS, allowOwnAS, aspath)
- }
- if path.IsAsLooped() != isLooped {
- // can't modify the existing one. needs to create one
- path = path.Clone(false)
- path.SetAsLooped(isLooped)
- // update accepted counter
- peer.adjRibIn.Update([]*table.Path{path})
- }
- if !path.IsAsLooped() {
- pathList = append(pathList, path)
- }
- }
- s.propagateUpdate(peer, pathList)
+ s.propagateUpdate(peer, peer.adjRibIn.PathList(familiesForSoftreset(peer, family), true))
}
return err
}
@@ -3007,7 +2980,6 @@ func (s *BgpServer) updateNeighbor(c *config.Neighbor) (needsSoftResetIn bool, e
"Topic": "Peer",
"Key": peer.ID(),
}).Info("Update aspath options")
- peer.fsm.pConf.AsPathOptions = c.AsPathOptions
needsSoftResetIn = true
}