]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: try again if dump is interrupted
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 8 Oct 2017 14:24:37 +0000 (16:24 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 8 Oct 2017 14:24:37 +0000 (16:24 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/ipc.c

index 5625526ada8572a7be2d6312a7824c4d5216214d..a460d2832c441d6aa77b7755f2e64395f9e05e47 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -855,11 +855,12 @@ static int kernel_get_device(struct wgdevice **dev, const char *interface)
        struct mnlg_socket *nlg;
        struct get_device_ctx ctx = { 0 };
 
+try_again:
        *dev = ctx.device = calloc(1, sizeof(struct wgdevice));
        if (!*dev)
                return -errno;
 
-       nlg= mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION);
+       nlg = mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION);
        if (!nlg) {
                free_wgdevice(*dev);
                *dev = NULL;
@@ -884,6 +885,8 @@ out:
                mnlg_socket_close(nlg);
        if (ret) {
                free_wgdevice(*dev);
+               if (ret == -EINTR)
+                       goto try_again;
                *dev = NULL;
        }
        errno = -ret;