summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-03-31 14:31:45 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-11 23:12:35 +0900
commitd670ecd940c8da57b0e841542ba4b4c30bb26dfe (patch)
tree7d0ee6d0967382a60ea17c8bd242d266eb1c009b
parent85d038d209ec5c11e72f4b04d681e76ad8fd661f (diff)
peer: prefix-limit calls peer.adjRibIn.Count only if enabled
No need to call peer.adjRibIn.Count() if prefix-limit isn't enabled (not configured). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--server/peer.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go
index cc71063a..6f4f6992 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -240,8 +240,8 @@ func (peer *Peer) handleUpdate(e *FsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg
peer.adjRibIn.Update(e.PathList)
for _, family := range peer.fsm.pConf.AfiSafis {
k, _ := bgp.GetRouteFamily(string(family.AfiSafiName))
- count := peer.adjRibIn.Count([]bgp.RouteFamily{k})
if maxPrefixes := int(family.PrefixLimit.Config.MaxPrefixes); maxPrefixes > 0 {
+ count := peer.adjRibIn.Count([]bgp.RouteFamily{k})
pct := int(family.PrefixLimit.Config.ShutdownThresholdPct)
if pct > 0 && !peer.prefixLimitWarned && count > (maxPrefixes*pct/100) {
peer.prefixLimitWarned = true