aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
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
commit599b84fbd18a0662661017f9f7e346567587ce31 (patch)
tree8706a1903bc9c3fcd8d15037fd4fb8dfd824e504 /src
parentwg: compile on gnu99 (diff)
downloadwireguard-tools-599b84fbd18a0662661017f9f7e346567587ce31.tar.xz
wireguard-tools-599b84fbd18a0662661017f9f7e346567587ce31.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/ipc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ipc.c b/src/ipc.c
index c64e332..5879109 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -530,8 +530,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;