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