diff options
| author | Russ White <russ@riw.us> | 2018-05-12 06:38:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-12 06:38:02 -0400 |
| commit | cfe50de15be87aced904965dbede086ccf21cc1c (patch) | |
| tree | b872010632d0efd8905dba72cac9ccf126d7a496 | |
| parent | 4f366c086c2ac8330174e052226cfdf2237e385d (diff) | |
| parent | c42eab4bf54897d26ab590734232e2de9d4af87b (diff) | |
Merge pull request #2213 from donaldsharp/errno
some small bgp issues
| -rw-r--r-- | bgpd/bgp_fsm.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index a11a4f78f7..3f5ff12cbc 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)) @@ -1256,7 +1257,8 @@ static int bgp_connect_check(struct thread *thread) /* If getsockopt is fail, this is fatal error. */ if (ret < 0) { - zlog_info("can't get sockopt for nonblocking connect"); + zlog_info("can't get sockopt for nonblocking connect: %d(%s)", + errno, safe_strerror(errno)); BGP_EVENT_ADD(peer, TCP_fatal_error); return -1; } @@ -1267,8 +1269,8 @@ static int bgp_connect_check(struct thread *thread) return 1; } else { if (bgp_debug_neighbor_events(peer)) - zlog_debug("%s [Event] Connect failed (%s)", peer->host, - safe_strerror(errno)); + zlog_debug("%s [Event] Connect failed %d(%s)", + peer->host, status, safe_strerror(status)); BGP_EVENT_ADD(peer, TCP_connection_open_failed); return 0; } @@ -1397,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); |
