aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-12 16:40:29 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-13 01:55:31 +0200
commitac7e7a3fcd5ac7d25ec75e5bf9c054762386a864 (patch)
tree22572d829918767e6fd88dbc55b35a78c5cbe861 /contrib
parentmain: get rid of unloaded debug message (diff)
downloadwireguard-monolithic-historical-ac7e7a3fcd5ac7d25ec75e5bf9c054762386a864.tar.xz
wireguard-monolithic-historical-ac7e7a3fcd5ac7d25ec75e5bf9c054762386a864.zip
tools: 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>
Diffstat (limited to '')
-rw-r--r--contrib/examples/embeddable-wg-library/wireguard.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/examples/embeddable-wg-library/wireguard.c b/contrib/examples/embeddable-wg-library/wireguard.c
index a32fd50..b8368e9 100644
--- a/contrib/examples/embeddable-wg-library/wireguard.c
+++ b/contrib/examples/embeddable-wg-library/wireguard.c
@@ -998,8 +998,15 @@ another:
goto cleanup;
}
if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, buffer)) < 0) {
- ret = -errno;
- goto cleanup;
+ /* 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;
+ goto cleanup;
+ }
}
if (len == MNL_CB_OK + 1)
goto another;