diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-11 13:40:55 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-11 13:46:43 +0200 |
commit | c42eab4bf54897d26ab590734232e2de9d4af87b (patch) | |
tree | ea5df8118391a2a3c7a0a2e088b8c5235dc381bc /bgpd | |
parent | bgpd: Cleanup messages from getsockopt (diff) | |
download | frr-c42eab4bf54897d26ab590734232e2de9d4af87b.tar.xz frr-c42eab4bf54897d26ab590734232e2de9d4af87b.zip |
bgpd: Respect ability to reach nexthop if available
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>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_fsm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index a22feaec8..3f5ff12cb 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -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); |