LISP: fix Proxy-ETR show command, VPP-660

Change-Id: I8b7dc3bf631bd228db23679534e04b8af7ac4ec7
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c
index d91f990..6c82d4c 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/vnet/lisp-cp/lisp_api.c
@@ -445,9 +445,24 @@
   /* *INDENT-OFF* */
   REPLY_MACRO2 (VL_API_SHOW_LISP_USE_PETR_REPLY,
   {
-      rmp->status = status;
-      gid_address_put (rmp->address, &addr);
-      rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
+    rmp->status = status;
+    ip_address_t *ip = &gid_address_ip (&addr);
+    switch (ip_addr_version (ip))
+      {
+      case IP4:
+        clib_memcpy (rmp->address, &ip_addr_v4 (ip),
+                     sizeof (ip_addr_v4 (ip)));
+        break;
+
+      case IP6:
+        clib_memcpy (rmp->address, &ip_addr_v6 (ip),
+                     sizeof (ip_addr_v6 (ip)));
+        break;
+
+      default:
+        ASSERT (0);
+      }
+    rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
   });
   /* *INDENT-ON* */
 }
diff --git a/src/vnet/lisp-cp/one.api b/src/vnet/lisp-cp/one.api
index 436c808..7cc9068 100644
--- a/src/vnet/lisp-cp/one.api
+++ b/src/vnet/lisp-cp/one.api
@@ -225,7 +225,7 @@
     @param context - sender context, to match reply w/ request
     @param is_ip4 - Address is IPv4 if set and IPv6 otherwise
     @param address - PETR IP address
-    @param is_add - add locator set if non-zero, else disable pitr
+    @param is_add - add locator set if non-zero, else disable PETR
 */
 define one_use_petr
 {
@@ -236,7 +236,7 @@
   u8 is_add;
 };
 
-/** \brief Reply for one_pitr_set_locator_set
+/** \brief Reply for one_use_petr
     @param context - returned sender context, to match reply w/ request
     @param retval - return code
 */
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index ff00bf5..4faf624 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -448,9 +448,24 @@
   /* *INDENT-OFF* */
   REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
   {
-      rmp->status = status;
-      gid_address_put (rmp->address, &addr);
-      rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
+    rmp->status = status;
+    ip_address_t *ip = &gid_address_ip (&addr);
+    switch (ip_addr_version (ip))
+      {
+      case IP4:
+        clib_memcpy (rmp->address, &ip_addr_v4 (ip),
+                     sizeof (ip_addr_v4 (ip)));
+        break;
+
+      case IP6:
+        clib_memcpy (rmp->address, &ip_addr_v6 (ip),
+                     sizeof (ip_addr_v6 (ip)));
+        break;
+
+      default:
+        ASSERT (0);
+      }
+    rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
   });
   /* *INDENT-ON* */
 }