]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
show: fix show all endpoints output
authorDmitry Selivanov <dseliv@gmail.com>
Wed, 8 Feb 2023 06:30:16 +0000 (09:30 +0300)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 8 Feb 2023 16:47:47 +0000 (13:47 -0300)
Currently "wg show all endpoints" prints interface name only once
while other "show all" commands print it on each line as man says.

Signed-off-by: Dmitry Selivanov <dseliv@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/show.c

index 3fd3d9e2a151354aa2453f4ee1fc6dd99dd6f09f..13777cf04280dd5f2103f0c51f5fb383c3f72e0f 100644 (file)
@@ -312,9 +312,9 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
                else
                        printf("off\n");
        } else if (!strcmp(param, "endpoints")) {
-               if (with_interface)
-                       printf("%s\t", device->name);
                for_each_wgpeer(device, peer) {
+                       if (with_interface)
+                               printf("%s\t", device->name);
                        printf("%s\t", key(peer->public_key));
                        if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6)
                                printf("%s\n", endpoint(&peer->endpoint.addr));