aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/embeddable-wg-library/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/embeddable-wg-library/test.c')
-rw-r--r--contrib/embeddable-wg-library/test.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/embeddable-wg-library/test.c b/contrib/embeddable-wg-library/test.c
index 4c95373..f9a8bd4 100644
--- a/contrib/embeddable-wg-library/test.c
+++ b/contrib/embeddable-wg-library/test.c
@@ -27,8 +27,11 @@ void list_devices(void)
perror("Unable to get device");
continue;
}
- wg_key_to_base64(key, device->public_key);
- printf("%s has public key %s\n", device_name, key);
+ if (device->flags & WGDEVICE_HAS_PUBLIC_KEY) {
+ wg_key_to_base64(key, device->public_key);
+ printf("%s has public key %s\n", device_name, key);
+ } else
+ printf("%s has no public key\n", device_name);
wg_for_each_peer(device, peer) {
wg_key_to_base64(key, peer->public_key);
printf(" - peer %s\n", key);