summaryrefslogtreecommitdiff
path: root/lib/tunnel_encaps.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tunnel_encaps.c')
-rw-r--r--lib/tunnel_encaps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tunnel_encaps.c b/lib/tunnel_encaps.c
index 590cf958..d65282d6 100644
--- a/lib/tunnel_encaps.c
+++ b/lib/tunnel_encaps.c
@@ -58,7 +58,19 @@ int decode_tunnel_ep(const void *p, size_t sub_tlv_len, struct tunnel_encap *enc
encap->ep.asn = get_u32(p);
u16 af = get_u16(p + 4);
+ encap->ep.af = af;
switch (af) {
+ case 0:
+ if (sub_tlv_len != 6) {
+ log(L_TRACE "WG: Fam 0 len error %d", sub_tlv_len);
+ return -1;
+ }
+ if (encap->ep.asn != 0) {
+ log(L_TRACE "WG: Fam 0 asn error %d", sub_tlv_len);
+ return -1;
+ }
+ encap->ep.ip = IP6_NONE;
+ return 0;
case NET_IP4:
if (sub_tlv_len != 10) {
log(L_TRACE "WG: IPv4 len error %d", sub_tlv_len);