bgpd: clear max prefix overflow on de-config

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>
This commit is contained in:
Dewi Morgan 2021-01-14 14:01:26 +00:00
parent be2579c0c2
commit ac4522e621

View 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))