diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-16 16:33:53 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-16 18:25:18 +0900 |
commit | 0cf8045e994b653030b721c574614d46c1870cf1 (patch) | |
tree | e409864aafea90c4aa4b990fb88a4917afd2596f /server | |
parent | 40ce51137a1bc3733d36ea045daae067eef735f0 (diff) |
policy: introduce policy option infra
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/fsm.go | 2 | ||||
-rw-r--r-- | server/peer.go | 2 | ||||
-rw-r--r-- | server/server.go | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/server/fsm.go b/server/fsm.go index 25aefaa2..89366d72 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -525,7 +525,7 @@ func (h *FSMHandler) recvMessageWithError() error { id := h.fsm.pConf.Config.NeighborAddress policyMutex.RLock() for _, path := range fmsg.PathList { - if h.fsm.policy.ApplyPolicy(id, table.POLICY_DIRECTION_IN, path) == nil { + if h.fsm.policy.ApplyPolicy(id, table.POLICY_DIRECTION_IN, path, nil) == nil { path.Filter(id, table.POLICY_DIRECTION_IN) } } diff --git a/server/peer.go b/server/peer.go index 5233c892..c4e09617 100644 --- a/server/peer.go +++ b/server/peer.go @@ -106,7 +106,7 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* pathList := []*table.Path{} filtered := []*table.Path{} for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) { - p := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path)) + p := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path), nil) if p == nil { filtered = append(filtered, path) continue diff --git a/server/server.go b/server/server.go index 4a198e49..7c18f088 100644 --- a/server/server.go +++ b/server/server.go @@ -744,7 +744,7 @@ func (server *BgpServer) RSimportPaths(peer *Peer, pathList []*table.Path) []*ta before.Filter(peer.ID(), table.POLICY_DIRECTION_IMPORT) continue } - after := server.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_IMPORT, before) + after := server.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_IMPORT, before, nil) if after == nil { before.Filter(peer.ID(), table.POLICY_DIRECTION_IMPORT) } else if after != before { @@ -784,7 +784,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] } sendPathList := make([]*table.Path, 0, len(dsts)) for _, dst := range dsts { - path := server.policy.ApplyPolicy(targetPeer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(targetPeer, dst.NewFeed(targetPeer.TableID()))) + path := server.policy.ApplyPolicy(targetPeer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(targetPeer, dst.NewFeed(targetPeer.TableID())), nil) if path != nil { sendPathList = append(sendPathList, path) } @@ -795,7 +795,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] } } else { for idx, path := range pathList { - pathList[idx] = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_IMPORT, path) + pathList[idx] = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_IMPORT, path, nil) } alteredPathList = pathList dsts := rib.ProcessPaths(pathList) @@ -819,7 +819,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] pathList := make([]*table.Path, len(sendPathList)) copy(pathList, sendPathList) for idx, path := range pathList { - path = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_EXPORT, filterpath(targetPeer, path)) + path = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_EXPORT, filterpath(targetPeer, path), nil) if path != nil { path.UpdatePathAttrs(&server.bgpConfig.Global, &targetPeer.conf) } @@ -1817,7 +1817,7 @@ 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); path != nil { + if path = server.policy.ApplyPolicy(peer.ID(), table.POLICY_DIRECTION_IN, path, nil); path != nil { pathList = append(pathList, path.Clone(net.ParseIP(peer.conf.Config.NeighborAddress), false)) } } |