diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-08-29 00:04:21 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-09-13 18:05:34 +0200 |
commit | a84bd2c2c75f2e28bb62e4beeecc4e5fe483b52b (patch) | |
tree | b4e91e0d31e84fa3a3ea970f8fbe0968ba9a765b | |
parent | 7191479a3653f69dae36eedba622a86aba19d9c9 (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; }; |