Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Dmitry Selivanov <dseliv@gmail.com>
To: wireguard@lists.zx2c4.com
Subject: [PATCH] wg: Fix show all endpoints output
Date: Sun, 29 Jan 2023 11:46:18 +0300	[thread overview]
Message-ID: <11c3d877-2d92-8593-0a9f-e2c918a791c3@gmail.com> (raw)

Currently "wg show all endpoints" prints interface name only once
while other "show all" commands print it on each line as man says.
---
 src/show.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/show.c b/src/show.c
index 3fd3d9e..13777cf 100644
--- a/src/show.c
+++ b/src/show.c
@@ -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));
-- 
2.30.2


             reply	other threads:[~2023-02-07  4:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-29  8:46 Dmitry Selivanov [this message]
2023-02-07 22:56 ` Jason A. Donenfeld
2023-02-08  6:30   ` Dmitry Selivanov
2023-02-08 16:48     ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11c3d877-2d92-8593-0a9f-e2c918a791c3@gmail.com \
    --to=dseliv@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).