summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-05-25 02:43:31 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-05-25 02:53:42 +0000
commit0dbf1d87cb6f42498e6607d616572fb80d36fd83 (patch)
treea942f671dd44ee75480ad6d3f162d9d29f1be42d /server
parent7c42e295e28c233fdb7a130681cd490308f116ca (diff)
policy: add local-pref action
$ gobgp policy statement st01 add action local-pref 110 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/peer.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go
index f75b6d57..1baee6cb 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -159,7 +159,15 @@ func (peer *Peer) filterpath(path *table.Path) *table.Path {
options := &table.PolicyOptions{
Neighbor: peer.fsm.peerInfo.Address,
}
- return peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, path, options)
+ path = peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, path, options)
+
+ // remove local-pref attribute
+ // we should do this after applying export policy since policy may
+ // set local-preference
+ if path != nil && peer.fsm.pConf.Config.PeerType == config.PEER_TYPE_EXTERNAL {
+ path.RemoveLocalPref()
+ }
+ return path
}
func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []*table.Path) {