From 424db825a3ee3c3ed386ac1ea0cb124e77dc35f9 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 7 May 2021 17:02:09 +0200 Subject: [PATCH] plugins: netlink: error handling fixes Handle EAGAIN properly, for both regular and resync flow, on any error in the regular flow (unless ENOBUFS) we want to check for nl_ifdown on any of the successfully parsed messages. Signed-off-by: Joachim Wiberg --- plugins/netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/netlink.c b/plugins/netlink.c index 3d440f17..e17a260c 100644 --- a/plugins/netlink.c +++ b/plugins/netlink.c @@ -234,6 +234,9 @@ static int nl_parse(int sd) while ((len = recv(sd, nl_buf, NL_BUFSZ, 0)) < 0) { switch (errno) { + case EAGAIN: /* Nothing more right now. */ + return 0; + case EINTR: /* Signal */ continue; @@ -372,9 +375,8 @@ static void nl_callback(void *arg, int sd, int events) if (errno == ENOBUFS) { /* netlink(7) */ _w("busy system, resynchronizing with kernel."); nl_resync(1); + return; } - - return; } /*