diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-08-29 00:04:21 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-01-12 23:34:17 +0100 |
commit | 26faaa926266b9b1a20c581f8226efa71afcb86a (patch) | |
tree | bb5fa8fe45e724b4fa78a1456adf61eeb2766149 | |
parent | 2a24a59d7dda9d5d323cd962aeaf104509b5973e (diff) |
TunnelEncaps: Add addess family
-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; }; |