misc: fix icmp
[vpp.git] / src / vnet / ip / icmp4.c
index 857c3b1..e9909bf 100644 (file)
 #include <vnet/ip/ip_sas.h>
 #include <vnet/util/throttle.h>
 
-static char *icmp_error_strings[] = {
-#define _(f,s) s,
-  foreach_icmp4_error
-#undef _
-};
-
 /** ICMP throttling */
 static throttle_t icmp_throttle;
 
@@ -219,8 +213,8 @@ VLIB_REGISTER_NODE (ip4_icmp_input_node) = {
 
   .format_trace = format_icmp_input_trace,
 
-  .n_errors = ARRAY_LEN (icmp_error_strings),
-  .error_strings = icmp_error_strings,
+  .n_errors = ICMP4_N_ERROR,
+  .error_counters = icmp4_error_counters,
 
   .n_next_nodes = 1,
   .next_nodes = {
@@ -324,13 +318,14 @@ ip4_icmp_error (vlib_main_t * vm,
 
          sw_if_index0 = vnet_buffer (p0)->sw_if_index[VLIB_RX];
 
-         vlib_buffer_copy_trace_flag (vm, p0, pi0);
+         vlib_buffer_copy_trace_flag (vm, org_p0, pi0);
 
          /* Add IP header and ICMPv4 header including a 4 byte data field */
          vlib_buffer_advance (p0,
                               -sizeof (ip4_header_t) -
                               sizeof (icmp46_header_t) - 4);
 
+         p0->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
          p0->current_length =
            p0->current_length > 576 ? 576 : p0->current_length;
          out_ip0 = vlib_buffer_get_current (p0);
@@ -399,8 +394,8 @@ VLIB_REGISTER_NODE (ip4_icmp_error_node) = {
   .name = "ip4-icmp-error",
   .vector_size = sizeof (u32),
 
-  .n_errors = ARRAY_LEN (icmp_error_strings),
-  .error_strings = icmp_error_strings,
+  .n_errors = ICMP4_N_ERROR,
+  .error_counters = icmp4_error_counters,
 
   .n_next_nodes = IP4_ICMP_ERROR_N_NEXT,
   .next_nodes = {
@@ -596,7 +591,7 @@ icmp4_init (vlib_main_t * vm)
   vlib_thread_main_t *tm = &vlib_thread_main;
   u32 n_vlib_mains = tm->n_vlib_mains;
 
-  throttle_init (&icmp_throttle, n_vlib_mains, 1e-3);
+  throttle_init (&icmp_throttle, n_vlib_mains, THROTTLE_BITS, 1e-5);
 
   return 0;
 }