bgpd: Keep the session down if maximum-prefix is reached

Under high load instances with hundreds of thousands of prefixes this
could result in very unstable systems.

When maximum-prefix is set, but restart timer is not set then the session
flaps between Idle(Pfx) -> Established -> Idle(Pfx) states.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2019-10-02 18:06:37 +03:00
parent fdf4ed925c
commit c0438a0e02

View File

@ -438,12 +438,15 @@ static int bgp_accept(struct thread *thread)
return -1; return -1;
} }
/* Check whether max prefix restart timer is set for the peer */ /* Do not try to reconnect if the peer reached maximum
if (peer1->t_pmax_restart) { * prefixes, restart timer is still running or the peer
* is shutdown.
*/
if (BGP_PEER_START_SUPPRESSED(peer1)) {
if (bgp_debug_neighbor_events(peer1)) if (bgp_debug_neighbor_events(peer1))
zlog_debug( zlog_debug(
"%s - incoming conn rejected - " "[Event] Incoming BGP connection rejected from %s "
"peer max prefix timer is active", "due to maximum-prefix or shutdown",
peer1->host); peer1->host);
close(bgp_sock); close(bgp_sock);
return -1; return -1;