bgpd: Cleanup messages from getsockopt

The handling of the return codes for getsockopt was slightly wrong.

getsockopt returns -1 on error and errno is set.
What to do with the return code at that point is dependent
on what sockopt you are asking about.  In this case
status holds the error returned for SO_ERROR.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-05-11 07:34:24 -04:00
parent 3dc755e492
commit 54ff5e9b02

View File

@ -1256,7 +1256,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 +1268,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;
}