From 37029305c671f4e2d091d6f6c22142634e409043 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Fri, 10 Aug 2018 05:30:06 -0700 Subject: Use IP and MAC API types for neighbors use address_t and mac_address_t for IPv6 and ARP entries and all other API calls in ip.api aprat from the route ones, that will follow in a separate commit Change-Id: I67161737c2184d3f8fc1e79ebd2b55121c5b0191 Signed-off-by: Neale Ranns --- src/vnet/ip/ip_types_api.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/vnet/ip/ip_types_api.c') diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c index 6bc035ebef2..b56101c355f 100644 --- a/src/vnet/ip/ip_types_api.c +++ b/src/vnet/ip/ip_types_api.c @@ -29,6 +29,30 @@ #include #undef vl_printfun +void +ip6_address_encode (const ip6_address_t * in, vl_api_ip6_address_t out) +{ + clib_memcpy (out, in, sizeof (*in)); +} + +void +ip6_address_decode (const vl_api_ip6_address_t in, ip6_address_t * out) +{ + clib_memcpy (out, in, sizeof (*out)); +} + +void +ip4_address_encode (const ip4_address_t * in, vl_api_ip4_address_t out) +{ + clib_memcpy (out, in, sizeof (*in)); +} + +void +ip4_address_decode (const vl_api_ip4_address_t in, ip4_address_t * out) +{ + clib_memcpy (out, in, sizeof (*out)); +} + static ip46_type_t ip_address_union_decode (const vl_api_address_union_t * in, vl_api_address_family_t af, ip46_address_t * out) @@ -67,9 +91,9 @@ ip_address_union_encode (const ip46_address_t * in, vl_api_address_union_t * out) { if (ADDRESS_IP6 == clib_net_to_host_u32 (af)) - memcpy (&out->ip6, &in->ip6, sizeof (out->ip6)); + ip6_address_encode (&in->ip6, out->ip6); else - memcpy (&out->ip4, &in->ip4, sizeof (out->ip4)); + ip4_address_encode (&in->ip4, out->ip4); } void -- cgit 1.2.3-korg