c11 safe string handling support
[vpp.git] / src / vpp / api / custom_dump.c
index aa63566..727032f 100644 (file)
@@ -536,7 +536,7 @@ static void *vl_api_tap_connect_t_print
   u8 *s;
   u8 null_mac[6];
 
-  memset (null_mac, 0, sizeof (null_mac));
+  clib_memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: tap_connect ");
   s = format (s, "tapname %s ", mp->tap_name);
@@ -561,7 +561,7 @@ static void *vl_api_tap_modify_t_print
   u8 *s;
   u8 null_mac[6];
 
-  memset (null_mac, 0, sizeof (null_mac));
+  clib_memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: tap_modify ");
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
@@ -602,7 +602,7 @@ static void *vl_api_tap_create_v2_t_print
   u8 *s;
   u8 null_mac[6];
 
-  memset (null_mac, 0, sizeof (null_mac));
+  clib_memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: tap_create_v2 ");
   s = format (s, "id %u ", ntohl (mp->id));
@@ -662,7 +662,7 @@ static void *vl_api_bond_create_t_print
   u8 *s;
   u8 null_mac[6];
 
-  memset (null_mac, 0, sizeof (null_mac));
+  clib_memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: bond_create ");
   if (memcmp (mp->mac_address, null_mac, 6))
@@ -944,19 +944,34 @@ static void *vl_api_mpls_tunnel_add_del_t_print
 
   s = format (0, "SCRIPT: mpls_tunnel_add_del ");
 
-  if (mp->mt_next_hop_sw_if_index)
-    s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
+  if (mp->mt_is_add == 0)
+    s = format (s, "del sw_if_index %d ", ntohl (mp->mt_sw_if_index));
 
-  if (mp->mt_next_hop_proto_is_ip4)
-    s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
+  mpls_label_t label = ntohl (mp->mt_next_hop_via_label);
+  if (label != MPLS_LABEL_INVALID)
+    s = format (s, "via-label %d ", label);
+  else if (mp->mt_next_hop_proto_is_ip4)
+    s = format (s, "via %U ", format_ip4_address, mp->mt_next_hop);
   else
-    s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
+    s = format (s, "via %U ", format_ip6_address, mp->mt_next_hop);
+
+  if (mp->mt_next_hop_sw_if_index != ~0)
+    s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
+  else if (mp->mt_next_hop_table_id)
+    s = format (s, "next-hop-table %d ", ntohl (mp->mt_next_hop_table_id));
 
   if (mp->mt_l2_only)
     s = format (s, "l2-only ");
 
-  if (mp->mt_is_add == 0)
-    s = format (s, "del ");
+  if (mp->mt_next_hop_n_out_labels)
+    {
+      u8 i;
+      for (i = 0; i < mp->mt_next_hop_n_out_labels; i++)
+       {
+         s = format (s, "out-label %d ",
+                     ntohl (mp->mt_next_hop_out_label_stack[i].label));
+       }
+    }
 
   FINISH;
 }
@@ -1021,7 +1036,7 @@ static void *vl_api_ip_neighbor_add_del_t_print
   u8 *s;
   u8 null_mac[6];
 
-  memset (null_mac, 0, sizeof (null_mac));
+  clib_memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: ip_neighbor_add_del ");
 
@@ -3586,7 +3601,7 @@ static void *vl_api_sw_interface_set_lldp_t_print
   u8 *s;
   u8 null_data[256];
 
-  memset (null_data, 0, sizeof (null_data));
+  clib_memset (null_data, 0, sizeof (null_data));
 
   s = format (0, "SCRIPT: sw_interface_set_lldp ");
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));