From 1f42101f2708452301c62ff2e07eaaad3bbcd31a Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 26 Jul 2019 10:18:51 -0700 Subject: tcp: count resets sent Type:feature Change-Id: Ie1ab4b24af9c654d5e0ed94b7fa96ca195b01c56 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.h | 3 +++ src/vnet/tcp/tcp_output.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index 8f2665d2a6a..698173ee28a 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -577,6 +577,9 @@ extern vlib_node_registration_t tcp6_rcv_process_node; extern vlib_node_registration_t tcp4_listen_node; extern vlib_node_registration_t tcp6_listen_node; +#define tcp_node_index(node_id, is_ip4) \ + ((is_ip4) ? tcp4_##node_id##_node.index : tcp6_##node_id##_node.index) + always_inline tcp_main_t * vnet_get_tcp_main () { diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 79cc95e9f0b..58d2167deb2 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -843,6 +843,8 @@ tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt, tcp_enqueue_to_ip_lookup_now (wrk, b, bi, is_ip4, fib_index); TCP_EVT_DBG (TCP_EVT_RST_SENT, tc); + vlib_node_increment_counter (vm, tcp_node_index (output, tc->c_is_ip4), + TCP_ERROR_RST_SENT, 1); } /** @@ -892,6 +894,8 @@ tcp_send_reset (tcp_connection_t * tc) } tcp_enqueue_to_ip_lookup_now (wrk, b, bi, tc->c_is_ip4, tc->c_fib_index); TCP_EVT_DBG (TCP_EVT_RST_SENT, tc); + vlib_node_increment_counter (vm, tcp_node_index (output, tc->c_is_ip4), + TCP_ERROR_RST_SENT, 1); } static void -- cgit 1.2.3-korg