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-05-08 18:52:55 +0200
commit862b31e98cdca6b9978336d239ef94eb42ed8b0b (patch)
tree2716796be708063d1f125cbc3867cd7322b39731 /proto
parent38dfa9660e5b8e8a0bc638d30ae56986350f5915 (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 9e7442b0..65008fbc 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;