show: fix show all endpoints output
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>
This commit is contained in:
parent
139aac59a5
commit
b4f6b4f229
|
@ -312,9 +312,9 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
|
||||||
else
|
else
|
||||||
printf("off\n");
|
printf("off\n");
|
||||||
} else if (!strcmp(param, "endpoints")) {
|
} else if (!strcmp(param, "endpoints")) {
|
||||||
if (with_interface)
|
|
||||||
printf("%s\t", device->name);
|
|
||||||
for_each_wgpeer(device, peer) {
|
for_each_wgpeer(device, peer) {
|
||||||
|
if (with_interface)
|
||||||
|
printf("%s\t", device->name);
|
||||||
printf("%s\t", key(peer->public_key));
|
printf("%s\t", key(peer->public_key));
|
||||||
if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6)
|
if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6)
|
||||||
printf("%s\n", endpoint(&peer->endpoint.addr));
|
printf("%s\n", endpoint(&peer->endpoint.addr));
|
||||||
|
|
Loading…
Reference in New Issue