mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
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:
parent
3dc755e492
commit
54ff5e9b02
@ -1256,7 +1256,8 @@ static int bgp_connect_check(struct thread *thread)
|
|||||||
|
|
||||||
/* If getsockopt is fail, this is fatal error. */
|
/* If getsockopt is fail, this is fatal error. */
|
||||||
if (ret < 0) {
|
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);
|
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1267,8 +1268,8 @@ static int bgp_connect_check(struct thread *thread)
|
|||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug("%s [Event] Connect failed (%s)", peer->host,
|
zlog_debug("%s [Event] Connect failed %d(%s)",
|
||||||
safe_strerror(errno));
|
peer->host, status, safe_strerror(status));
|
||||||
BGP_EVENT_ADD(peer, TCP_connection_open_failed);
|
BGP_EVENT_ADD(peer, TCP_connection_open_failed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user