diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-10-01 19:06:27 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-08 18:52:55 +0200 |
commit | a3ac30fd374a665c67ca0718ce9999f8f0c03be2 (patch) | |
tree | 2143e5a6ed769fb8d53125ed06a78bb1dde3f363 /lib | |
parent | e58547642077da985fcc721e0625b02b4e9ddd45 (diff) |
WIP
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tunnel_encaps.c | 20 | ||||
-rw-r--r-- | lib/tunnel_encaps.h | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/tunnel_encaps.c b/lib/tunnel_encaps.c index 590cf958..b77bc710 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); @@ -289,3 +301,11 @@ int format_tunnel_encap(const eattr *a, byte *buf, uint size) return pos - buf; } + +void register_format_tunnel_encap(int type, format_tunnel_encap_fn cb) +{ +} + +void unregister_format_tunnel_encap(int type, format_tunnel_encap_fn cb) +{ +} diff --git a/lib/tunnel_encaps.h b/lib/tunnel_encaps.h index 7358947e..12a905db 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; }; @@ -32,8 +33,13 @@ struct tunnel_encap { u16 flags; }; +typedef int (*format_tunnel_encap_fn)(const struct tunnel_encap *, byte *buf, uint size); + int decode_tunnel_encap(const eattr *e, struct tunnel_encap *encap, struct pool *pool); int format_tunnel_encap(const eattr *a, byte *buf, uint size); +void register_format_tunnel_encap(int type, format_tunnel_encap_fn cb); +void unregister_format_tunnel_encap(int type, format_tunnel_encap_fn cb); + #endif /* _BIRD_TUNNEL_ENCAPS_ */ |