diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-17 09:26:56 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-17 09:26:56 -0800 |
commit | 70fae5c8cc6c8f9e96f2b0f143a71cca551725bc (patch) | |
tree | 4f05101f70da8ffa3af22230317db17e7d6248e5 /server/server.go | |
parent | 7a5cf6a2b9c0b9f2f2227b35dce2855b157fda91 (diff) |
rpki: add reason to rpki monitor api
tells a reason why notificaiton was sent, withdraw, peer down, and others
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go index 2853dc1e..3471ee7e 100644 --- a/server/server.go +++ b/server/server.go @@ -564,7 +564,7 @@ func (server *BgpServer) dropPeerAllRoutes(peer *Peer) []*SenderMsg { for _, rf := range peer.configuredRFlist() { dsts := server.globalRib.DeletePathsByPeer(peer.fsm.peerInfo, rf) - server.validatePaths(dsts) + server.validatePaths(dsts, true) if peer.isRouteServerClient() { pathList := make([]*table.Path, len(dsts)) for _, targetPeer := range server.neighborMap { @@ -773,14 +773,19 @@ func (server *BgpServer) isRpkiMonitored() bool { return false } -func (server *BgpServer) validatePaths(dsts []*table.Destination) { +func (server *BgpServer) validatePaths(dsts []*table.Destination, peerDown bool) { isMonitor := server.isRpkiMonitored() for _, dst := range dsts { if isMonitor { rrList := make([]*api.ROAResult, 0, len(dst.WithdrawnList)) for _, path := range dst.WithdrawnList { if path.Validation() == config.RPKI_VALIDATION_RESULT_TYPE_INVALID { + reason := api.ROAResult_WITHDRAW + if peerDown { + reason = api.ROAResult_PEER_DOWN + } rr := &api.ROAResult{ + Reason: reason, Address: path.GetSource().Address.String(), Timestamp: path.GetTimestamp().Unix(), OriginAs: path.GetSourceAs(), @@ -838,7 +843,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] moded = append(moded, server.RSimportPaths(targetPeer, pathList)...) } dsts := rib.ProcessPaths(append(pathList, moded...)) - server.validatePaths(dsts) + server.validatePaths(dsts, false) for _, targetPeer := range server.neighborMap { if !targetPeer.isRouteServerClient() || targetPeer.fsm.state != bgp.BGP_FSM_ESTABLISHED { continue @@ -861,7 +866,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] } alteredPathList = pathList dsts := rib.ProcessPaths(pathList) - server.validatePaths(dsts) + server.validatePaths(dsts, false) sendPathList := make([]*table.Path, 0, len(dsts)) for _, dst := range dsts { path := dst.NewFeed(table.GLOBAL_RIB_NAME) |