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.
@@ -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,10 +375,9 @@ 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;
}
+ }
/*
* Linux doesn't send route changes when interfaces go down, so
