diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-17 21:50:32 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-17 21:50:32 +0900 |
commit | dbd0c21d2e97877de7a2d24ab975984c33371442 (patch) | |
tree | 4d1cde1c48699457f8c9f314e6717a7fa864aa23 /pkg | |
parent | 6b05d9db0f3e5aa2230d26083e800edc07b6d298 (diff) |
server: fix handleRouteRefresh and softResetOut
both assume that getBestFromLocal() returns filtered paths by policies
but it doesn't. Paths filtered by policies are returned as withdraw
paths.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/server/server.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go index 5df03680..3e5c5ebf 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -944,10 +944,7 @@ func (s *BgpServer) handleRouteRefresh(peer *peer, e *fsmMsg) []*table.Path { return nil } rfList := []bgp.RouteFamily{rf} - accepted, filtered := s.getBestFromLocal(peer, rfList) - for _, path := range filtered { - accepted = append(accepted, path.Clone(true)) - } + accepted, _ := s.getBestFromLocal(peer, rfList) return accepted } @@ -2195,16 +2192,20 @@ func (s *BgpServer) softResetOut(addr string, family bgp.RouteFamily, deferral b } } - pathList, filtered := s.getBestFromLocal(peer, families) + pathList, _ := s.getBestFromLocal(peer, families) if len(pathList) > 0 { - sendfsmOutgoingMsg(peer, pathList, nil, false) - } - if !deferral && len(filtered) > 0 { - withdrawnList := make([]*table.Path, 0, len(filtered)) - for _, p := range filtered { - withdrawnList = append(withdrawnList, p.Clone(true)) + if deferral { + pathList = func() []*table.Path { + l := make([]*table.Path, 0, len(pathList)) + for _, p := range pathList { + if !p.IsWithdraw { + l = append(l, p) + } + } + return l + }() } - sendfsmOutgoingMsg(peer, withdrawnList, nil, false) + sendfsmOutgoingMsg(peer, pathList, nil, false) } } return nil |