diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-06-30 14:30:49 +0900 |
---|---|---|
committer | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-07-01 14:26:36 +0900 |
commit | c2709b81a2b3f9ee22c7f0049682efd829a82d96 (patch) | |
tree | 863590e1174f8169196cf93cdc02f97c9d3ad1e1 /server/server.go | |
parent | 2e0ba39ce9b5d393fe64fa20d98598b8bb454d59 (diff) |
server: apply distribute filter only when route server client propagates routes
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/server.go b/server/server.go index e6f41c47..b2d5a293 100644 --- a/server/server.go +++ b/server/server.go @@ -209,7 +209,7 @@ func (server *BgpServer) Serve() { server.addLocalRib(loc) loc.setPolicy(peer, server.policyMap) // set distribute policy - peer.setPolicy(server.policyMap) + peer.setDistributePolicy(server.policyMap) pathList := make([]*table.Path, 0) for _, p := range server.neighborMap { @@ -403,7 +403,7 @@ func applyPolicies(peer *Peer, loc *LocalRib, d Direction, pathList []*table.Pat if !path.IsWithdraw { var applied bool = false if d == POLICY_DIRECTION_DISTRIBUTE { - applied, path = peer.applyPolicies(path) + applied, path = peer.applyDistributePolicies(path) } else { applied, path = loc.applyPolicies(d, path) } @@ -482,12 +482,14 @@ func (server *BgpServer) propagateUpdate(neighborAddress string, RouteServerClie msgs := make([]*SenderMsg, 0) if RouteServerClient { + p := server.neighborMap[neighborAddress] + newPathList := applyPolicies(p, nil, POLICY_DIRECTION_DISTRIBUTE, pathList) for _, loc := range server.localRibMap { targetPeer := server.neighborMap[loc.OwnerName()] if loc.isGlobal() || loc.OwnerName() == neighborAddress { continue } - sendPathList, _ := loc.rib.ProcessPaths(applyPolicies(targetPeer, loc, POLICY_DIRECTION_IMPORT, dropSameAsPath(targetPeer.config.PeerAs, filterpath(targetPeer, pathList)))) + sendPathList, _ := loc.rib.ProcessPaths(applyPolicies(targetPeer, loc, POLICY_DIRECTION_IMPORT, dropSameAsPath(targetPeer.config.PeerAs, filterpath(targetPeer, newPathList)))) if targetPeer.fsm.state != bgp.BGP_FSM_ESTABLISHED || len(sendPathList) == 0 { continue } @@ -651,7 +653,7 @@ func (server *BgpServer) handlePolicy(pl config.RoutingPolicy) { }).Info("call set policy") loc.setPolicy(targetPeer, server.policyMap) // set distribute policy - targetPeer.setPolicy(server.policyMap) + targetPeer.setDistributePolicy(server.policyMap) } } @@ -1132,7 +1134,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if grpcReq.RequestType == REQ_NEIGHBOR_POLICY_ADD_DISTRIBUTE || grpcReq.RequestType == REQ_NEIGHBOR_POLICY_DEL_DISTRIBUTE { - peer.setPolicy(reqPolicyMap) + peer.setDistributePolicy(reqPolicyMap) } else { loc := server.localRibMap[peer.config.NeighborAddress.String()] loc.setPolicy(peer, reqPolicyMap) |