summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-15 18:40:41 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-15 22:28:27 -0800
commitef1c084c2c8c3833d7753d079a17d6cf4b998742 (patch)
treeca7822b843918b64bc988dcb13bd6dd698fd80b4 /server
parentea45280cfb816ff1ef432799638c31407e6002ac (diff)
server: fix softresetout to send withdrawn for only routes in adj-out
This fixes softresetout to send withdrawn updates for only routes in adj-out. Currently, softreset sends withdrawn updates for ALL routes rejected by export policy. The problem is, even if export policy is configured to rejecte any routes, softreset sends withdrawn updates. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/server.go b/server/server.go
index f642330b..c8745c42 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1670,6 +1670,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg {
}
for _, peer := range peers {
rfList := peer.configuredRFlist()
+ sentPathList := peer.adjRibOut.PathList(rfList, false)
peer.adjRibOut.Drop(rfList)
pathList, filtered := peer.getBestFromLocal(rfList)
if len(pathList) > 0 {
@@ -1677,10 +1678,21 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg {
msgs = append(msgs, newSenderMsg(peer, table.CreateUpdateMsgFromPaths(pathList)))
}
if len(filtered) > 0 {
+ withdrawnList := make([]*table.Path, 0, len(filtered))
for _, p := range filtered {
- p.IsWithdraw = true
+ found := false
+ for _, sentPath := range sentPathList {
+ if p.GetNlri() == sentPath.GetNlri() {
+ found = true
+ break
+ }
+ }
+ if found {
+ p.IsWithdraw = true
+ withdrawnList = append(withdrawnList, p)
+ }
}
- msgs = append(msgs, newSenderMsg(peer, table.CreateUpdateMsgFromPaths(filtered)))
+ msgs = append(msgs, newSenderMsg(peer, table.CreateUpdateMsgFromPaths(withdrawnList)))
}
}
grpcReq.ResponseCh <- &GrpcResponse{}