]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Cleanup messages from getsockopt
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 11:34:24 +0000 (07:34 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 11:34:24 +0000 (07:34 -0400)
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>
bgpd/bgp_fsm.c

index a11a4f78f772732dc77b9a916539a57a7c3e961a..a22feaec844c1436c2a2b6d844aa7b980484bf91 100644 (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;
        }