diff options
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/reass/ip4_full_reass.c | 25 | ||||
-rw-r--r-- | src/vnet/ip/reass/ip4_sv_reass.c | 16 | ||||
-rw-r--r-- | src/vnet/ip/reass/ip6_full_reass.c | 23 | ||||
-rw-r--r-- | src/vnet/ip/reass/ip6_sv_reass.c | 22 |
4 files changed, 36 insertions, 50 deletions
diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c index d2069c0876c..79f4673a7f5 100644 --- a/src/vnet/ip/reass/ip4_full_reass.c +++ b/src/vnet/ip/reass/ip4_full_reass.c @@ -1172,6 +1172,7 @@ ip4_full_reass_inline (vlib_main_t * vm, vlib_node_runtime_t * node, else if (reass) { u32 handoff_thread_idx; + u32 counter = ~0; switch (ip4_full_reass_update (vm, node, rm, rt, reass, &bi0, &next0, &error0, CUSTOM == type, &handoff_thread_idx)) @@ -1186,29 +1187,23 @@ ip4_full_reass_inline (vlib_main_t * vm, vlib_node_runtime_t * node, handoff_thread_idx; break; case IP4_REASS_RC_TOO_MANY_FRAGMENTS: - vlib_node_increment_counter (vm, node->node_index, - IP4_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG, - 1); - ip4_full_reass_drop_all (vm, node, reass); - ip4_full_reass_free (rm, rt, reass); - goto next_packet; + counter = IP4_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG; break; case IP4_REASS_RC_NO_BUF: - vlib_node_increment_counter (vm, node->node_index, - IP4_ERROR_REASS_NO_BUF, 1); - ip4_full_reass_drop_all (vm, node, reass); - ip4_full_reass_free (rm, rt, reass); - goto next_packet; + counter = IP4_ERROR_REASS_NO_BUF; break; case IP4_REASS_RC_INTERNAL_ERROR: - /* drop everything and start with a clean slate */ - vlib_node_increment_counter (vm, node->node_index, - IP4_ERROR_REASS_INTERNAL_ERROR, + counter = IP4_ERROR_REASS_INTERNAL_ERROR; + break; + } + + if (~0 != counter) + { + vlib_node_increment_counter (vm, node->node_index, counter, 1); ip4_full_reass_drop_all (vm, node, reass); ip4_full_reass_free (rm, rt, reass); goto next_packet; - break; } } else diff --git a/src/vnet/ip/reass/ip4_sv_reass.c b/src/vnet/ip/reass/ip4_sv_reass.c index 31177809f7b..f5fa575e64d 100644 --- a/src/vnet/ip/reass/ip4_sv_reass.c +++ b/src/vnet/ip/reass/ip4_sv_reass.c @@ -846,24 +846,24 @@ slow_path: ip4_sv_reass_rc_t rc = ip4_sv_reass_update (vm, node, rm, ip0, reass, bi0); + u32 counter = ~0; switch (rc) { case IP4_SV_REASS_RC_OK: /* nothing to do here */ break; case IP4_SV_REASS_RC_TOO_MANY_FRAGMENTS: - vlib_node_increment_counter (vm, node->node_index, - IP4_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG, - 1); - ip4_sv_reass_free (vm, rm, rt, reass); - goto next_packet; + counter = IP4_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG; break; case IP4_SV_REASS_RC_UNSUPP_IP_PROTO: - vlib_node_increment_counter (vm, node->node_index, - IP4_ERROR_REASS_UNSUPP_IP_PROT, 1); + counter = IP4_ERROR_REASS_UNSUPP_IP_PROT; + break; + } + if (~0 != counter) + { + vlib_node_increment_counter (vm, node->node_index, counter, 1); ip4_sv_reass_free (vm, rm, rt, reass); goto next_packet; - break; } if (reass->is_complete) { diff --git a/src/vnet/ip/reass/ip6_full_reass.c b/src/vnet/ip/reass/ip6_full_reass.c index 9ec40cd347c..8486aea6753 100644 --- a/src/vnet/ip/reass/ip6_full_reass.c +++ b/src/vnet/ip/reass/ip6_full_reass.c @@ -1144,6 +1144,7 @@ ip6_full_reassembly_inline (vlib_main_t * vm, else if (reass) { u32 handoff_thread_idx; + u32 counter = ~0; switch (ip6_full_reass_update (vm, node, rm, rt, reass, &bi0, &next0, &error0, frag_hdr, is_custom_app, &handoff_thread_idx)) @@ -1158,28 +1159,22 @@ ip6_full_reassembly_inline (vlib_main_t * vm, handoff_thread_idx; break; case IP6_FULL_REASS_RC_TOO_MANY_FRAGMENTS: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG, - 1); - ip6_full_reass_drop_all (vm, node, reass); - ip6_full_reass_free (rm, rt, reass); - goto next_packet; + counter = IP6_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG; break; case IP6_FULL_REASS_RC_NO_BUF: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_NO_BUF, 1); - ip6_full_reass_drop_all (vm, node, reass); - ip6_full_reass_free (rm, rt, reass); - goto next_packet; + counter = IP6_ERROR_REASS_NO_BUF; break; case IP6_FULL_REASS_RC_INTERNAL_ERROR: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_INTERNAL_ERROR, + counter = IP6_ERROR_REASS_INTERNAL_ERROR; + break; + } + if (~0 != counter) + { + vlib_node_increment_counter (vm, node->node_index, counter, 1); ip6_full_reass_drop_all (vm, node, reass); ip6_full_reass_free (rm, rt, reass); goto next_packet; - break; } } else diff --git a/src/vnet/ip/reass/ip6_sv_reass.c b/src/vnet/ip/reass/ip6_sv_reass.c index a2dcfedf311..f18bbe0d564 100644 --- a/src/vnet/ip/reass/ip6_sv_reass.c +++ b/src/vnet/ip/reass/ip6_sv_reass.c @@ -645,31 +645,27 @@ ip6_sv_reassembly_inline (vlib_main_t * vm, goto packet_enqueue; } + u32 counter = ~0; switch (ip6_sv_reass_update (vm, node, rm, reass, bi0, frag_hdr)) { case IP6_SV_REASS_RC_OK: /* nothing to do here */ break; case IP6_SV_REASS_RC_TOO_MANY_FRAGMENTS: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG, - 1); - ip6_sv_reass_free (vm, rm, rt, reass); - goto next_packet; + counter = IP6_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG; break; case IP6_SV_REASS_RC_UNSUPP_IP_PROTO: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_UNSUPP_IP_PROTO, - 1); - ip6_sv_reass_free (vm, rm, rt, reass); - goto next_packet; + counter = IP6_ERROR_REASS_UNSUPP_IP_PROTO; break; case IP6_SV_REASS_RC_INTERNAL_ERROR: - vlib_node_increment_counter (vm, node->node_index, - IP6_ERROR_REASS_INTERNAL_ERROR, 1); + counter = IP6_ERROR_REASS_INTERNAL_ERROR; + break; + } + if (~0 != counter) + { + vlib_node_increment_counter (vm, node->node_index, counter, 1); ip6_sv_reass_free (vm, rm, rt, reass); goto next_packet; - break; } if (reass->is_complete) |