summaryrefslogtreecommitdiff
path: root/proto/wireguard
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-03-08 17:45:35 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2020-09-13 18:05:34 +0200
commit07859c7bf81df806f74cbe4ab4a612d00e15918b (patch)
treed2214c0c4faa34ab06c5e8c14e52014d8cff606e /proto/wireguard
parent02f4c3048ff7eb9a39f994d95b0dad12ffbd9b21 (diff)
Wireguard: Fixes
Diffstat (limited to 'proto/wireguard')
-rw-r--r--proto/wireguard/wireguard.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c
index e60a0b97..2882c862 100644
--- a/proto/wireguard/wireguard.c
+++ b/proto/wireguard/wireguard.c
@@ -87,14 +87,14 @@ int decode_remote_ep(void *p, size_t sub_tlv_len, u32 *as4, ip_addr *remote_ep)
*as4 = get_u32(p);
u16 af = get_u16(p + 4);
switch (af) {
- case AF_INET:
+ case NET_IP4:
if (sub_tlv_len != 10) {
log(L_TRACE "WG: IPv4 len error %d", sub_tlv_len);
return -1;
}
*remote_ep = ipa_from_ip4(get_ip4(p + 6));
return 0;
- case AF_INET6:
+ case NET_IP6:
if (sub_tlv_len != 22) {
log(L_TRACE "WG: IPv6 len error %d", sub_tlv_len);
return -1;
@@ -461,8 +461,10 @@ wg_rt_notify(struct proto *P, struct channel *ch UNUSED, struct network *n,
if (!previp) {
debug("WG: remove first\n");
peer->first_allowedip = ip->next_allowedip;
- if (peer->last_allowedip == ip)
+ if (peer->last_allowedip == ip) {
peer->last_allowedip = NULL;
+ peer->first_allowedip = NULL;
+ }
} else {
debug("WG: remove middle\n");
// Remove