]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Correctly calculate threshold being reached
authorDonald Sharp <sharpd@nvidia.com>
Mon, 12 Oct 2020 14:36:37 +0000 (10:36 -0400)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 13 Oct 2020 08:27:04 +0000 (11:27 +0300)
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>
bgpd/bgp_route.c

index 88534f8fb85b3cc9f2dd22b0987b31de3d7e7d9d..ae353e3870f9bf14a7fc5b323ccd547fb21b15e7 100644 (file)
@@ -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)