diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-02-01 22:46:33 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-02-01 23:11:12 +0900 |
commit | 21b7301e049dc1ac5128001e49ec1a2b194ead7b (patch) | |
tree | eeec9bec953df8e5bc2b92ee2fdcedad492a2646 /server | |
parent | 2419b8add20024c3c90210a36cf208a8ef467a10 (diff) |
server: fix soft-reset-in to handle in-policy change properly
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go index a49914e0..c90f8306 100644 --- a/server/server.go +++ b/server/server.go @@ -1885,10 +1885,18 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { for _, peer := range peers { pathList := []*table.Path{} for _, path := range peer.adjRibIn.PathList([]bgp.RouteFamily{grpcReq.RouteFamily}, false) { - if path = server.policy.ApplyPolicy(peer.ID(), table.POLICY_DIRECTION_IN, path, nil); path != nil { + exResult := path.Filtered(peer.ID()) + path.Filter(peer.ID(), table.POLICY_DIRECTION_NONE) + if server.policy.ApplyPolicy(peer.ID(), table.POLICY_DIRECTION_IN, path, nil) != nil { pathList = append(pathList, path.Clone(false)) + } else { + path.Filter(peer.ID(), table.POLICY_DIRECTION_IN) + if exResult != table.POLICY_DIRECTION_IN { + pathList = append(pathList, path.Clone(true)) + } } } + peer.adjRibIn.RefreshAcceptedNumber([]bgp.RouteFamily{grpcReq.RouteFamily}) m, _ := server.propagateUpdate(peer, pathList) msgs = append(msgs, m...) } |