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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-05-07 17:02:09 +02:00
parent b9cc4cd629
commit 424db825a3
+4 -2
View File
@@ -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;
}
/*