wg: don't fail if a netlink interface dump is inconsistent
Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed during the dump. That's unfortunate, but is pretty common on busy systems that are adding and removing tunnels all the time. Rather than retrying, potentially indefinitely, we just work with the partial results. Reported-by: Robert Gerus <ar@is-a.cat> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
9b1394b2dc
commit
599b84fbd1
|
@ -998,9 +998,16 @@ another:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, buffer)) < 0) {
|
if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, buffer)) < 0) {
|
||||||
|
/* Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed
|
||||||
|
* during the dump. That's unfortunate, but is pretty common on busy
|
||||||
|
* systems that are adding and removing tunnels all the time. Rather
|
||||||
|
* than retrying, potentially indefinitely, we just work with the
|
||||||
|
* partial results. */
|
||||||
|
if (errno != EINTR) {
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (len == MNL_CB_OK + 1)
|
if (len == MNL_CB_OK + 1)
|
||||||
goto another;
|
goto another;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
@ -530,9 +530,16 @@ another:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, buffer)) < 0) {
|
if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, buffer)) < 0) {
|
||||||
|
/* Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed
|
||||||
|
* during the dump. That's unfortunate, but is pretty common on busy
|
||||||
|
* systems that are adding and removing tunnels all the time. Rather
|
||||||
|
* than retrying, potentially indefinitely, we just work with the
|
||||||
|
* partial results. */
|
||||||
|
if (errno != EINTR) {
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (len == MNL_CB_OK + 1)
|
if (len == MNL_CB_OK + 1)
|
||||||
goto another;
|
goto another;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Reference in New Issue