summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-03-05 19:43:05 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-03-07 18:03:15 +0100
commit2eda953a2af82d37f2b0b4bda4dfa639b8dc862b (patch)
tree774cce9127b72e9ccf5bb87a54b12a7361787507 /lib
parentlib: fix live log fields for crashlog (diff)
downloadfrr-2eda953a2af82d37f2b0b4bda4dfa639b8dc862b.tar.xz
frr-2eda953a2af82d37f2b0b4bda4dfa639b8dc862b.zip
lib: make live log sockets non-blocking
This was the intent here to begin with, not sure where I managed to forget this along the way... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/zlog_live.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/zlog_live.c b/lib/zlog_live.c
index eeedf5c42..7abf1a801 100644
--- a/lib/zlog_live.c
+++ b/lib/zlog_live.c
@@ -22,6 +22,7 @@
#include "frrcu.h"
#include "zlog.h"
#include "printfrr.h"
+#include "network.h"
DEFINE_MTYPE_STATIC(LOG, LOG_LIVE, "log vtysh live target");
@@ -109,6 +110,8 @@ static void zlog_live(struct zlog_target *zt, struct zlog_msg *msgs[],
for (size_t msgpos = 0; msgpos < msgtotal; msgpos += sent) {
sent = sendmmsg(fd, mmhs + msgpos, msgtotal - msgpos, 0);
+ if (sent <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
+ break;
if (sent <= 0)
goto out_err;
}
@@ -195,6 +198,7 @@ void zlog_live_open(struct zlog_live_cfg *cfg, int prio_min, int *other_fd)
zte = container_of(zt, struct zlt_live, zt);
cfg->target = zte;
+ set_nonblocking(sockets[0]);
zte->fd = sockets[0];
zte->zt.prio_min = prio_min;
zte->zt.logfn = zlog_live;