summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/server/server.go b/server/server.go
index f6d0a8b8..5a1dd8fc 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1751,24 +1751,31 @@ func (s *BgpServer) softResetIn(addr string, family bgp.RouteFamily) error {
return err
}
for _, peer := range peers {
- pathList := []*table.Path{}
families := []bgp.RouteFamily{family}
if family == bgp.RouteFamily(0) {
families = peer.configuredRFlist()
}
+ 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 {
- if hasOwnASLoop(peer.fsm.peerInfo.LocalAS, int(peer.fsm.pConf.AsPathOptions.Config.AllowOwnAs), aspath) {
- continue
- }
+ isLooped = hasOwnASLoop(peer.fsm.peerInfo.LocalAS, int(peer.fsm.pConf.AsPathOptions.Config.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)
}
- pathList = append(pathList, path.Clone(false))
}
- peer.adjRibIn.RefreshAcceptedNumber(families)
s.propagateUpdate(peer, pathList)
}
return err