summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-10-12 10:36:37 -0400
committerDonald Sharp <sharpd@nvidia.com>2020-10-12 10:36:37 -0400
commitb1823b69f602c4e9a10f15c92f1c3a2fcb836a30 (patch)
tree641ded072e2f954ee06a839a31f037f2c39e9fce
parent8b6b6b694d7c5ae8193e0c9a3907b9143df44a07 (diff)
bgpd: Correctly calculate threshold being reached
if (pcout > (pcount * peer->max_threshold[afi][safi] / 100 )) is always true. So the very first route received will always trigger the warning. We actually want the warning to happen when we hit the threshold. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_route.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 43ba4ceef6..229e9af91f 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3167,7 +3167,8 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
UNSET_FLAG(peer->af_sflags[afi][safi],
PEER_STATUS_PREFIX_LIMIT);
- if (pcount > (pcount * peer->pmax_threshold[afi][safi] / 100)) {
+ if (pcount
+ > (peer->pmax[afi][safi] * peer->pmax_threshold[afi][safi] / 100)) {
if (CHECK_FLAG(peer->af_sflags[afi][safi],
PEER_STATUS_PREFIX_THRESHOLD)
&& !always)