]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: clear max prefix overflow on de-config 7867/head
authorDewi Morgan <dewi.morgan@intl.att.com>
Thu, 14 Jan 2021 14:01:26 +0000 (14:01 +0000)
committerDewi Morgan <dewi.morgan@intl.att.com>
Thu, 14 Jan 2021 14:01:26 +0000 (14:01 +0000)
A bgp neighbor remains in Idle state in the event that the number
of received prefixes exceeds the configured maximum prefix for the
neighbor. The neighbor remains in idle state even after de-configuring
the maximum prefix limit for the neighbor.

The fix is to clear the neighbor overflow state if set, after
de-configuring the neighbor maximum-prefix commnd.

This allows the neighbor to establish without having to perform a
clear operation. It also avoids the misleading neigbor summary
indicating that the neighbor is in prefix overflow state (PfxCt)
when no limit is configured for the neighbor.

Signed-off-by: Dewi Morgan <dewi.morgan@intl.att.com>
bgpd/bgpd.c

index 9a2693fd56359a0e07a3799a0a90f65a1c0b78cd..9297ec4711c9c103509c94f0da259abe9fe6d39b 100644 (file)
@@ -6974,6 +6974,22 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
        return 0;
 }
 
+static bool peer_maximum_prefix_clear_overflow(struct peer *peer)
+{
+       if (!CHECK_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
+               return false;
+
+       UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
+       if (peer->t_pmax_restart) {
+               BGP_TIMER_OFF(peer->t_pmax_restart);
+               if (bgp_debug_neighbor_events(peer))
+                       zlog_debug("%s Maximum-prefix restart timer cancelled",
+                                  peer->host);
+       }
+       BGP_EVENT_ADD(peer, BGP_Start);
+       return true;
+}
+
 int peer_maximum_prefix_set(struct peer *peer, afi_t afi, safi_t safi,
                            uint32_t max, uint8_t threshold, int warning,
                            uint16_t restart, bool force)
@@ -7095,7 +7111,11 @@ int peer_maximum_prefix_unset(struct peer *peer, afi_t afi, safi_t safi)
                        member->pmax[afi][safi] = 0;
                        member->pmax_threshold[afi][safi] = 0;
                        member->pmax_restart[afi][safi] = 0;
+
+                       peer_maximum_prefix_clear_overflow(member);
                }
+       } else {
+               peer_maximum_prefix_clear_overflow(peer);
        }
 
        return 0;
@@ -7298,18 +7318,8 @@ int peer_clear(struct peer *peer, struct listnode **nnode)
 {
        if (!CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
            || !CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN)) {
-               if (CHECK_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) {
-                       UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
-                       if (peer->t_pmax_restart) {
-                               BGP_TIMER_OFF(peer->t_pmax_restart);
-                               if (bgp_debug_neighbor_events(peer))
-                                       zlog_debug(
-                                               "%s Maximum-prefix restart timer canceled",
-                                               peer->host);
-                       }
-                       BGP_EVENT_ADD(peer, BGP_Start);
+               if (peer_maximum_prefix_clear_overflow(peer))
                        return 0;
-               }
 
                peer->v_start = BGP_INIT_START_TIMER;
                if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))