]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Respect ability to reach nexthop if available 2213/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 11:40:55 +0000 (07:40 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 11:46:43 +0000 (07:46 -0400)
When bgp is thinking about opening a connection to a peer,
if we are connected to zebra, allow that to influence our
decision to start the connection.

Found Scenario:

Both bgp and zebra are started up at the same time.  Zebra is
being used to create the connected route through which bgp
will establish a peering relationship.  The machine is a
bit loaded due to other startup conditions and as such bgp
gets to the connection stage here before zebra has installed
the route.  If bgp does not respect zebra data when it does
have a connection then we will attempt to connect.  The
connect will fail because there is no route.  At that time
we will go into the connect timeout(2 minutes) and delay
connection.

What this does.  If we have established a zebra connection and
we do not have a clear path to the destination at this point
do not allow the connection to proceed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_fsm.c

index a22feaec844c1436c2a2b6d844aa7b980484bf91..3f5ff12cbc0306c19f86d983f8cda55d55401a24 100644 (file)
@@ -52,6 +52,7 @@
 #include "bgpd/bgp_memory.h"
 #include "bgpd/bgp_keepalives.h"
 #include "bgpd/bgp_io.h"
+#include "bgpd/bgp_zebra.h"
 
 DEFINE_HOOK(peer_backward_transition, (struct peer * peer), (peer))
 DEFINE_HOOK(peer_established, (struct peer * peer), (peer))
@@ -1398,13 +1399,14 @@ int bgp_start(struct peer *peer)
        if (!bgp_find_or_add_nexthop(peer->bgp, peer->bgp,
                                     family2afi(peer->su.sa.sa_family), NULL,
                                     peer, connected)) {
-#if defined(HAVE_CUMULUS)
-               if (bgp_debug_neighbor_events(peer))
-                       zlog_debug("%s [FSM] Waiting for NHT", peer->host);
+               if (bgp_zebra_num_connects()) {
+                       if (bgp_debug_neighbor_events(peer))
+                               zlog_debug("%s [FSM] Waiting for NHT",
+                                          peer->host);
 
-               BGP_EVENT_ADD(peer, TCP_connection_open_failed);
-               return 0;
-#endif
+                       BGP_EVENT_ADD(peer, TCP_connection_open_failed);
+                       return 0;
+               }
        }
 
        assert(!peer->t_write);