diff options
-rw-r--r-- | proto/wireguard/wireguard.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c index 53e6fc2f..b0095aa7 100644 --- a/proto/wireguard/wireguard.c +++ b/proto/wireguard/wireguard.c @@ -636,6 +636,31 @@ wg_dump(struct proto *P) } FIB_WALK_END; } + + struct wg_peer *peer = NULL; + + log(L_TRACE "WG: dump peers"); + wg_for_each_peer(p->dev, peer) { + wg_key_b64_string base64; + wg_key_to_base64(base64, peer->public_key); + debug("WG: peer %s\n", base64); + + struct wg_allowedip *allowedip = NULL; + wg_for_each_allowedip(peer, allowedip) { + ip_addr ip; + + switch (allowedip->family) { + case AF_INET: + ip = ipa_from_in4(allowedip->ip4); + break; + case AF_INET6: + ip = ipa_from_in6(allowedip->ip6); + break; + } + + debug("allowedip %I/%d\n", ip, allowedip->cidr); + } + } } static void |