diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-06 14:19:43 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-06 15:07:36 -0800 |
commit | d280168106c9ef9ed68ad117b913f52e6bae1827 (patch) | |
tree | 37d67be13c26c19a366e2c1d5621eff74a8984b4 /server/peer.go | |
parent | fa6c8fe58b7ef9aca401262be8677bb4526c3fcd (diff) |
add route collector feature support
like openbgp's route collector, sends all updates (not only best).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/peer.go b/server/peer.go index bf4f2928..967a0e5d 100644 --- a/server/peer.go +++ b/server/peer.go @@ -108,13 +108,19 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* options := &table.PolicyOptions{ Neighbor: peer.fsm.peerInfo.Address, } - for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) { + var source []*table.Path + if peer.gConf.Collector.Enabled { + source = peer.localRib.GetPathList(peer.TableID(), rfList) + } else { + source = peer.localRib.GetBestPathList(peer.TableID(), rfList) + } + for _, path := range source { p := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path), options) if p == nil { filtered = append(filtered, path) continue } - if !peer.isRouteServerClient() { + if !peer.gConf.Collector.Enabled && !peer.isRouteServerClient() { p = p.Clone(p.IsWithdraw) p.UpdatePathAttrs(&peer.gConf, &peer.conf) } |