aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_types_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-12-16 00:53:11 +0000
committerDamjan Marion <dmarion@me.com>2020-02-21 09:54:19 +0000
commit282872127bbeee6ae59ab3f885c09bad601ee0cc (patch)
tree4f1ef8243b194ca8bf6f1acd62ba4a7d688d371e /src/vnet/ip/ip_types_api.c
parentd057625d499525625d60d2207665eaeb755e380e (diff)
ipsec: IPSec protection for multi-point tunnel interfaces
Type: feature Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Iaba2ab11bfaa1c8db4023434e3043ac39500f938
Diffstat (limited to 'src/vnet/ip/ip_types_api.c')
-rw-r--r--src/vnet/ip/ip_types_api.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c
index 0f7f0e530f9..2e92e723772 100644
--- a/src/vnet/ip/ip_types_api.c
+++ b/src/vnet/ip/ip_types_api.c
@@ -163,6 +163,26 @@ ip_address_decode (const vl_api_address_t * in, ip46_address_t * out)
return (ip_address_union_decode (&in->un, in->af, out));
}
+void
+ip_address_decode2 (const vl_api_address_t * in, ip_address_t * out)
+{
+ switch (clib_net_to_host_u32 (in->af))
+ {
+ case ADDRESS_IP4:
+ clib_memset (out, 0, sizeof (*out));
+ clib_memcpy (&ip_addr_v4 (out), &in->un.ip4, sizeof (ip_addr_v4 (out)));
+ out->version = AF_IP4;
+ break;
+ case ADDRESS_IP6:
+ clib_memcpy (&ip_addr_v6 (out), &in->un.ip6, sizeof (ip_addr_v6 (out)));
+ out->version = AF_IP6;
+ break;
+ default:
+ ASSERT (!"Unknown address family in API address type");
+ break;
+ }
+}
+
static void
ip_address_union_encode (const ip46_address_t * in,
vl_api_address_family_t af,
@@ -197,6 +217,22 @@ ip_address_encode (const ip46_address_t * in,
}
void
+ip_address_encode2 (const ip_address_t * in, vl_api_address_t * out)
+{
+ switch (in->version)
+ {
+ case AF_IP4:
+ out->af = clib_net_to_host_u32 (ADDRESS_IP4);
+ ip4_address_encode (&in->ip.v4, out->un.ip4);
+ break;
+ case AF_IP6:
+ out->af = clib_net_to_host_u32 (ADDRESS_IP6);
+ ip6_address_encode (&in->ip.v6, out->un.ip6);
+ break;
+ }
+}
+
+void
ip_prefix_decode (const vl_api_prefix_t * in, fib_prefix_t * out)
{
switch (clib_net_to_host_u32 (in->address.af))