diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-28 23:00:49 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-28 23:20:59 +0900 |
commit | df6c998bc1718e093aabdeab6ef0f857ccc229d1 (patch) | |
tree | 3c8699bbf01a0abf0515ddd81640e1054f624d23 /server | |
parent | ff09df9841485e6dec5ac228d6c1a55c1f2e5245 (diff) |
table: update accepted number in adj-in rib after softreset-in
update accepted number in adj-in rib after AllowOwnAs has changed.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 19 |
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 |