ipsec: fix sa counters in esp-decrypt
Type: fix
Fixes:
@@ -156,18 +156,19 @@ esp_decrypt_inline (vlib_main_t * vm,
if (vnet_buffer (b[0])->ipsec.sad_index != current_sa_index)
{
+ if (current_sa_pkts)
+ vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
+ current_sa_index,
+ current_sa_pkts,
+ current_sa_bytes);
+ current_sa_bytes = current_sa_pkts = 0;
+
current_sa_index = vnet_buffer (b[0])->ipsec.sad_index;
sa0 = pool_elt_at_index (im->sad, current_sa_index);
cpd.icv_sz = sa0->integ_icv_size;
cpd.iv_sz = sa0->crypto_iv_size;
cpd.flags = sa0->flags;
cpd.sa_index = current_sa_index;
-
- vlib_increment_combined_counter (&ipsec_sa_counters, thread_index,
- current_sa_index, current_sa_pkts,
- current_sa_bytes);
-
- current_sa_bytes = current_sa_pkts = 0;
}
/* store packet data for next round for easier prefetch */
