summaryrefslogtreecommitdiffstats
path: root/src/plugins/wireguard/wireguard_peer.h
diff options
context:
space:
mode:
authorArtem Glazychev <artem.glazychev@xored.com>2021-06-03 20:11:54 +0700
committerEd Warnicke <hagbard@gmail.com>2021-10-06 17:57:46 +0000
commit7dd3b5b5e37a4019ae335296ba9c4bd1e465fd17 (patch)
tree0cd0a76ebce52b2907514e4e4394af32094d2ab7 /src/plugins/wireguard/wireguard_peer.h
parent0c4931cb351929a1ccdb6b29431def3705f101d7 (diff)
wireguard: add ipv6 support
Type: improvement Signed-off-by: Artem Glazychev <artem.glazychev@xored.com> Change-Id: If1a7e82ce163c4c4acaa5acf45ad2b88371396f6
Diffstat (limited to 'src/plugins/wireguard/wireguard_peer.h')
-rw-r--r--src/plugins/wireguard/wireguard_peer.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/wireguard/wireguard_peer.h b/src/plugins/wireguard/wireguard_peer.h
index e23feb7866f..c719ac19511 100644
--- a/src/plugins/wireguard/wireguard_peer.h
+++ b/src/plugins/wireguard/wireguard_peer.h
@@ -31,7 +31,14 @@ typedef struct ip4_udp_header_t_
udp_header_t udp;
} __clib_packed ip4_udp_header_t;
+typedef struct ip6_udp_header_t_
+{
+ ip6_header_t ip6;
+ udp_header_t udp;
+} __clib_packed ip6_udp_header_t;
+
u8 *format_ip4_udp_header (u8 * s, va_list * va);
+u8 *format_ip6_udp_header (u8 *s, va_list *va);
typedef struct wg_peer_endpoint_t_
{
@@ -141,15 +148,16 @@ wg_peer_assign_thread (u32 thread_id)
}
static_always_inline bool
-fib_prefix_is_cover_addr_4 (const fib_prefix_t *p1, const ip4_address_t *ip4)
+fib_prefix_is_cover_addr_46 (const fib_prefix_t *p1, const ip46_address_t *ip)
{
switch (p1->fp_proto)
{
case FIB_PROTOCOL_IP4:
- return (ip4_destination_matches_route (&ip4_main, &p1->fp_addr.ip4, ip4,
- p1->fp_len) != 0);
+ return (ip4_destination_matches_route (&ip4_main, &p1->fp_addr.ip4,
+ &ip->ip4, p1->fp_len) != 0);
case FIB_PROTOCOL_IP6:
- return (false);
+ return (ip6_destination_matches_route (&ip6_main, &p1->fp_addr.ip6,
+ &ip->ip6, p1->fp_len) != 0);
case FIB_PROTOCOL_MPLS:
break;
}