diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-21 10:21:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-21 10:21:54 +0900 |
commit | 95619d069070cd820171f1cd3d88088dbc909c52 (patch) | |
tree | 722127af70df1733d69f23068ddd6e4c49236557 /server/peer.go | |
parent | 0e64f7c080fafb61dd97023bb25e0c59b53b7556 (diff) |
server: apply policy before sending for ROUTE_REFRESH
Rather than just sending routes in the AdjOut, apply policies to
routes in the Loc and sends them.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/peer.go b/server/peer.go index 55240cf6..c9c6e61e 100644 --- a/server/peer.go +++ b/server/peer.go @@ -123,8 +123,8 @@ func (peer *Peer) getAccepted(rfList []bgp.RouteFamily) []*table.Path { return pathList } -func (peer *Peer) getBestFromLocal() ([]*table.Path, []*table.Path) { - pathList, filtered := peer.ApplyPolicy(table.POLICY_DIRECTION_EXPORT, filterpath(peer, peer.localRib.GetBestPathList(peer.localRib.GetRFlist()))) +func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []*table.Path) { + pathList, filtered := peer.ApplyPolicy(table.POLICY_DIRECTION_EXPORT, filterpath(peer, peer.localRib.GetBestPathList(rfList))) if peer.isRouteServerClient() == false { for _, path := range pathList { path.UpdatePathAttrs(&peer.gConf, &peer.conf) @@ -203,7 +203,14 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) ([]*table.Path, bool, []*b break } if _, ok := peer.capMap[bgp.BGP_CAP_ROUTE_REFRESH]; ok { - pathList = peer.adjRib.GetOutPathList([]bgp.RouteFamily{rf}) + rfList := []bgp.RouteFamily{rf} + peer.adjRib.DropOut(rfList) + pathList, filtered := peer.getBestFromLocal(rfList) + peer.adjRib.UpdateOut(pathList) + for _, path := range filtered { + path.IsWithdraw = true + pathList = append(pathList, path) + } } else { log.WithFields(log.Fields{ "Topic": "Peer", |