diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-09-29 15:08:18 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-08 18:52:55 +0200 |
commit | c4c07589c792ca6e47f7a154905fc23949d17845 (patch) | |
tree | 2137a345028c7456c114e0fbed10df938c008fc1 | |
parent | c036e19aa40d783b5d3758899abc6220da1b7e11 (diff) |
Wireguard: Dump peers
-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 |