]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add some more debug information on read issues in FPM
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 18 Jan 2018 14:17:57 +0000 (09:17 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 18 Jan 2018 14:31:20 +0000 (09:31 -0500)
When we receive a read failure in handling a FPM read
let's add a bit more information to what we think has
gone wrong, in a hope that debugging will be a bit easier.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_fpm.c

index 0d0a2cb3bf1ed450792459e0d4512c71588aa096..a6e0882ff89b489a1f36e5e9bd8020296900b765 100644 (file)
@@ -713,7 +713,15 @@ static int zfpm_read_cb(struct thread *thread)
                nbyte = stream_read_try(ibuf, zfpm_g->sock,
                                        FPM_MSG_HDR_LEN - already);
                if (nbyte == 0 || nbyte == -1) {
-                       zfpm_connection_down("closed socket in read");
+                       if (nbyte == -1) {
+                               char buffer[1024];
+
+                               sprintf(buffer, "closed socket in read(%d): %s",
+                                       errno, safe_strerror(errno));
+                               zfpm_connection_down(buffer);
+                       }
+                       else
+                               zfpm_connection_down("closed socket in read");
                        return 0;
                }
 
@@ -743,7 +751,15 @@ static int zfpm_read_cb(struct thread *thread)
                nbyte = stream_read_try(ibuf, zfpm_g->sock, msg_len - already);
 
                if (nbyte == 0 || nbyte == -1) {
-                       zfpm_connection_down("failed to read message");
+                       if (nbyte == -1) {
+                               char buffer[1024];
+
+                               sprintf(buffer, "failed to read message(%d) %s",
+                                       errno, safe_strerror(errno));
+                               zfpm_connection_down(buffer);
+                       }
+                       else
+                               zfpm_connection_down("failed to read message");
                        return 0;
                }