diff options
Diffstat (limited to 'src/vlib/drop.c')
-rw-r--r-- | src/vlib/drop.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/vlib/drop.c b/src/vlib/drop.c index 3971123839d..3fda1d9b3b6 100644 --- a/src/vlib/drop.c +++ b/src/vlib/drop.c @@ -16,6 +16,7 @@ */ #include <vlib/vlib.h> +#include <vppinfra/vector/count_equal.h> typedef enum { @@ -73,7 +74,8 @@ counter_index (vlib_main_t * vm, vlib_error_t e) n = vlib_get_node (vm, ni); ci = vlib_error_get_code (&vm->node_main, e); - ASSERT (ci < n->n_errors); + if (ci >= n->n_errors) + return CLIB_U32_MAX; ci += n->error_heap_index; @@ -91,9 +93,12 @@ format_error_trace (u8 * s, va_list * va) u32 i; error_node = vlib_get_node (vm, vlib_error_get_node (&vm->node_main, e[0])); - i = counter_index (vm, vlib_error_get_code (&vm->node_main, e[0])) + - error_node->error_heap_index; - s = format (s, "%v: %s", error_node->name, em->counters_heap[i].name); + i = counter_index (vm, vlib_error_get_code (&vm->node_main, e[0])); + if (i != CLIB_U32_MAX) + { + i += error_node->error_heap_index; + s = format (s, "%v: %s", error_node->name, em->counters_heap[i].desc); + } return s; } @@ -221,7 +226,8 @@ process_drop_punt (vlib_main_t * vm, n_left -= count; c_index = counter_index (vm, error[0]); - em->counters[c_index] += count; + if (c_index != CLIB_U32_MAX) + em->counters[c_index] += count; vlib_error_elog_count (vm, c_index, count); } @@ -232,7 +238,7 @@ process_drop_punt (vlib_main_t * vm, /* If there is no punt function, free the frame as well. */ if (disposition == ERROR_DISPOSITION_PUNT && !vm->os_punt_frame) - vlib_frame_free (vm, node, frame); + vlib_frame_free (vm, frame); } else vm->os_punt_frame (vm, node, frame); @@ -254,7 +260,6 @@ VLIB_NODE_FN (error_punt_node) (vlib_main_t * vm, return process_drop_punt (vm, node, frame, ERROR_DISPOSITION_PUNT); } -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (error_drop_node) = { .name = "drop", .flags = VLIB_NODE_FLAG_IS_DROP, @@ -262,9 +267,7 @@ VLIB_REGISTER_NODE (error_drop_node) = { .format_trace = format_error_trace, .validate_frame = validate_error_frame, }; -/* *INDENT-ON* */ -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (error_punt_node) = { .name = "punt", .flags = (VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH @@ -273,7 +276,6 @@ VLIB_REGISTER_NODE (error_punt_node) = { .format_trace = format_error_trace, .validate_frame = validate_error_frame, }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON |