pppoe: use explicit types in api
[vpp.git] / src / plugins / pppoe / pppoe_test.c
index 72d1865..d66eab1 100644 (file)
@@ -19,6 +19,9 @@
 
 #include <vppinfra/error.h>
 #include <pppoe/pppoe.h>
+#include <vnet/format_fns.h>
+
+#include <vnet/ip/ip_types_api.h>
 
 #define __plugin_msg_base pppoe_test_main.msg_id_base
 #include <vlibapi/vat_helper_macros.h>
@@ -158,19 +161,19 @@ api_pppoe_add_del_session (vat_main_t * vam)
 
   M (PPPOE_ADD_DEL_SESSION, mp);
 
+
   if (ipv6_set)
     {
-      clib_memcpy (mp->client_ip, &client_ip.ip6, sizeof (client_ip.ip6));
+      ip_address_encode(&client_ip, IP46_TYPE_IP6, &mp->client_ip);
     }
   else
     {
-      clib_memcpy (mp->client_ip, &client_ip.ip4, sizeof (client_ip.ip4));
+      ip_address_encode(&client_ip, IP46_TYPE_IP4, &mp->client_ip);
     }
 
   mp->decap_vrf_id = ntohl (decap_vrf_id);
   mp->session_id = ntohl (session_id);
   mp->is_add = is_add;
-  mp->is_ipv6 = ipv6_set;
   memcpy (mp->client_mac, client_mac, 6);
 
   S (mp);
@@ -182,8 +185,8 @@ static void vl_api_pppoe_session_details_t_handler
   (vl_api_pppoe_session_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  ip46_address_t client_ip = to_ip46 (mp->is_ipv6, mp->client_ip);
-
+  ip46_address_t client_ip;
+  ip_address_decode(&mp->client_ip, &client_ip);
   print (vam->ofp, "%11d%14d%24U%14d%14d%30U%30U",
        ntohl (mp->sw_if_index), ntohl (mp->session_id),
        format_ip46_address, &client_ip, IP46_TYPE_ANY,