summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-12-31 11:27:40 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2021-01-12 23:34:17 +0100
commitf83dfc0e217e7cd2bcbf278987bbc0b5ed6d4236 (patch)
tree70fa7cd21007815cf2ce6c2c47f36444f20578d4
parent7ebee8bc0c09256d896dedd58ce2522bbcf09b00 (diff)
Wireguard: Don't add endpoint if not set
-rw-r--r--proto/wireguard/wireguard.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c
index 442aabfb..da80d9f7 100644
--- a/proto/wireguard/wireguard.c
+++ b/proto/wireguard/wireguard.c
@@ -67,9 +67,10 @@ int get_device(struct wg_proto *p, wg_device **pdev, const char *device_name)
}
peer->next_peer = NULL;
- sockaddr_fill((sockaddr*)&peer->endpoint.addr,
- ipa_is_ip4(pc->endpoint) ? AF_INET : AF_INET6,
- pc->endpoint, NULL, pc->remote_port);
+ if (!ip6_equal(pc->endpoint, IPA_NONE))
+ sockaddr_fill((sockaddr*)&peer->endpoint.addr,
+ ipa_is_ip4(pc->endpoint) ? AF_INET : AF_INET6,
+ pc->endpoint, NULL, pc->remote_port);
wg_allowedip *allowedip = calloc(1, sizeof(wg_allowedip));
peer->first_allowedip = allowedip;