diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/peer.go | 16 | ||||
-rw-r--r-- | server/server.go | 10 |
2 files changed, 7 insertions, 19 deletions
diff --git a/server/peer.go b/server/peer.go index 0d0eb490..d191e734 100644 --- a/server/peer.go +++ b/server/peer.go @@ -58,8 +58,8 @@ func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p peer.tableId = table.GLOBAL_RIB_NAME } rfs, _ := config.AfiSafis(conf.AfiSafis).ToRfList() - peer.adjRibIn = table.NewAdjRib(peer.ID(), rfs, g.Collector.Enabled) - peer.adjRibOut = table.NewAdjRib(peer.ID(), rfs, g.Collector.Enabled) + peer.adjRibIn = table.NewAdjRib(peer.ID(), rfs) + peer.adjRibOut = table.NewAdjRib(peer.ID(), rfs) return peer } @@ -136,19 +136,13 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* options := &table.PolicyOptions{ Neighbor: peer.fsm.peerInfo.Address, } - var source []*table.Path - if peer.fsm.gConf.Collector.Enabled { - source = peer.localRib.GetPathList(peer.TableID(), rfList) - } else { - source = peer.localRib.GetBestPathList(peer.TableID(), rfList) - } - for _, path := range source { + for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) { p := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path), options) if p == nil { filtered = append(filtered, path) continue } - if !peer.fsm.gConf.Collector.Enabled && !peer.isRouteServerClient() { + if !peer.isRouteServerClient() { p = p.Clone(p.IsWithdraw) p.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf) } @@ -189,7 +183,7 @@ func (peer *Peer) processOutgoingPaths(paths, withdrawals []*table.Path) []*tabl if path == nil { continue } - if !peer.isRouteServerClient() && !peer.fsm.gConf.Collector.Enabled { + if !peer.isRouteServerClient() { path = path.Clone(path.IsWithdraw) path.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf) } diff --git a/server/server.go b/server/server.go index a021dd84..37c43447 100644 --- a/server/server.go +++ b/server/server.go @@ -474,7 +474,7 @@ func (server *BgpServer) dropPeerAllRoutes(peer *Peer, families []bgp.RouteFamil for _, rf := range families { best, _ := server.globalRib.DeletePathsByPeer(ids, peer.fsm.peerInfo, rf) - if !peer.isRouteServerClient() && !server.bgpConfig.Global.Collector.Enabled { + if !peer.isRouteServerClient() { server.broadcastBests(best[table.GLOBAL_RIB_NAME]) } @@ -692,9 +692,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] if len(best[table.GLOBAL_RIB_NAME]) == 0 { return nil, alteredPathList } - if !server.bgpConfig.Global.Collector.Enabled { - server.broadcastBests(best[table.GLOBAL_RIB_NAME]) - } + server.broadcastBests(best[table.GLOBAL_RIB_NAME]) } for _, targetPeer := range server.neighborMap { @@ -1604,9 +1602,6 @@ func (server *BgpServer) handleModConfig(grpcReq *GrpcRequest) error { MaxLabel: g.MplsLabelMax, }, AfiSafis: families, - Collector: config.Collector{ - Enabled: g.Collector, - }, }, } if err := config.SetDefaultConfigValues(nil, b); err != nil { @@ -1742,7 +1737,6 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { ListenAddresses: g.ListenConfig.LocalAddressList, MplsLabelMin: g.MplsLabelRange.MinLabel, MplsLabelMax: g.MplsLabelRange.MaxLabel, - Collector: g.Collector.Enabled, }, } grpcReq.ResponseCh <- result |