summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-12-31 11:27:40 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2020-09-13 18:05:34 +0200
commitce2368782e1e087cdbc2c130096d2e6e502d5211 (patch)
tree1b81861242a20b24bbc93404705f65f02851551d /proto
parent7f9d4d9ae6f012dccb5b31e79c9e178123bdcef0 (diff)
Wireguard: Don't add endpoint if not set
Diffstat (limited to 'proto')
-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;