]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Keep the session down if maximum-prefix is reached
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 2 Oct 2019 15:06:37 +0000 (18:06 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 16 Oct 2019 05:26:46 +0000 (08:26 +0300)
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>
bgpd/bgp_network.c

index 1bbcf8ca2b8f19161871c5486a10a76750daa6d8..0db2c3cce43141ebda80652aec73744627aa1e9e 100644 (file)
@@ -440,12 +440,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;