From 0d03284efce17fc088afe8b8a33f01aeeeeecb67 Mon Sep 17 00:00:00 2001 From: Paul Atkins Date: Thu, 24 Mar 2022 11:26:16 +0000 Subject: bfd: use local error index when incrementing node counters When incrementing node counters with vlib_node_increment_counter the local error index should be passed in. vlib_node_increment_counter adds the local index to the nodes base index to get the counter to write to. If we pass in the global counter index, the offset gets added again in the fn, and we then potentially write into memory that is not part of the counter vector. Type: fix Signed-off-by: Paul Atkins Change-Id: I43be33a51bcb52d520495d326b971c1d848d96b5 --- src/vnet/bfd/bfd_udp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/vnet/bfd/bfd_udp.c') diff --git a/src/vnet/bfd/bfd_udp.c b/src/vnet/bfd/bfd_udp.c index e835eac4a13..b715dbb376f 100644 --- a/src/vnet/bfd/bfd_udp.c +++ b/src/vnet/bfd/bfd_udp.c @@ -1342,12 +1342,12 @@ bfd_udp_input (vlib_main_t * vm, vlib_node_runtime_t * rt, if (is_ipv6) { vlib_node_increment_counter (vm, bfd_udp6_input_node.index, - b0->error, 1); + error0, 1); } else { vlib_node_increment_counter (vm, bfd_udp4_input_node.index, - b0->error, 1); + error0, 1); } const bfd_udp_session_t *bus = &bs->udp; ip_adjacency_t *adj = adj_get (bus->adj_index); @@ -1488,12 +1488,12 @@ bfd_udp_echo_input (vlib_main_t * vm, vlib_node_runtime_t * rt, if (is_ipv6) { vlib_node_increment_counter (vm, bfd_udp_echo6_input_node.index, - b0->error, 1); + BFD_UDP_ERROR_NONE, 1); } else { vlib_node_increment_counter (vm, bfd_udp_echo4_input_node.index, - b0->error, 1); + BFD_UDP_ERROR_NONE, 1); } next0 = BFD_UDP_ECHO_INPUT_NEXT_REPLY_REWRITE; } -- cgit 1.2.3-korg