diff options
-rw-r--r-- | lib/tunnel_encaps.c | 12 | ||||
-rw-r--r-- | lib/tunnel_encaps.h | 1 |
2 files changed, 13 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); diff --git a/lib/tunnel_encaps.h b/lib/tunnel_encaps.h index 7358947e..1fc69806 100644 --- a/lib/tunnel_encaps.h +++ b/lib/tunnel_encaps.h @@ -19,6 +19,7 @@ /* Tunnel Encapsulation */ struct tunnel_endpoint { u32 asn; + u16 af; ip_addr ip; }; |