tap: fix the api for use of vec_len
[vpp.git] / src / vnet / devices / tap / tapv2_api.c
index ea61852..ac38128 100644 (file)
@@ -83,7 +83,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
     ap->num_rx_queues = mp->num_rx_queues;
 
   if (mp->host_if_name_set)
-    ap->host_if_name = mp->host_if_name;
+    ap->host_if_name = format (0, "%s%c", mp->host_if_name, 0);
 
   if (mp->host_mac_addr_set)
     {
@@ -91,10 +91,10 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
     }
 
   if (mp->host_namespace_set)
-    ap->host_namespace = mp->host_namespace;
+    ap->host_namespace = format (0, "%s%c", mp->host_namespace, 0);
 
   if (mp->host_bridge_set)
-    ap->host_bridge = mp->host_bridge;
+    ap->host_bridge = format (0, "%s%c", mp->host_bridge, 0);
 
   if (mp->host_ip4_prefix_set)
     {
@@ -164,6 +164,11 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
   rmp->sw_if_index = ntohl (ap->sw_if_index);
 
   vl_api_send_msg (reg, (u8 *) rmp);
+
+  vec_free (ap->host_if_name);
+  vec_free (ap->host_namespace);
+  vec_free (ap->host_bridge);
+
 }
 
 static void