summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-18 13:44:14 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-18 14:00:51 +0900
commite11b09d7eae851d777a06ee18fde7865a361f5bb (patch)
treef33fd973aadabd3cb6ead949f0c8e3fadb481c20 /server/peer.go
parent93d1dca70aa0ae3b34050d24ad7462b8757213bf (diff)
server: disable advertised number calculation with multiple neighbors
AdjRibOut isn't in memory so needs to be calculated on the fly. Doing such for multiple neighbors consumes too much CPU (especially there are lots of routes). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/peer.go b/server/peer.go
index 05018f89..780af50d 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -502,7 +502,7 @@ func (peer *Peer) PassConn(conn *net.TCPConn) {
}
}
-func (peer *Peer) ToConfig() *config.Neighbor {
+func (peer *Peer) ToConfig(getAdvertised bool) *config.Neighbor {
// create copy which can be access to without mutex
conf := *peer.fsm.pConf
@@ -529,8 +529,12 @@ func (peer *Peer) ToConfig() *config.Neighbor {
if peer.fsm.state == bgp.BGP_FSM_ESTABLISHED {
rfList := peer.configuredRFlist()
- pathList, _ := peer.getBestFromLocal(rfList)
- conf.State.AdjTable.Advertised = uint32(len(pathList))
+ if getAdvertised {
+ pathList, _ := peer.getBestFromLocal(rfList)
+ conf.State.AdjTable.Advertised = uint32(len(pathList))
+ } else {
+ conf.State.AdjTable.Advertised = 0
+ }
conf.State.AdjTable.Received = uint32(peer.adjRibIn.Count(rfList))
conf.State.AdjTable.Accepted = uint32(peer.adjRibIn.Accepted(rfList))