aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-06-05 15:42:54 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-06-05 18:50:58 +0000
commit867dfdda33cb46887bf5332ade992812bf465918 (patch)
treefdfcd4e30c94d781a34e5d60c1493c9ee5a0f981
parent21aed5cc995148047e80a48f436d12bca7b0073a (diff)
ipsec: fix sa counters in esp-decrypt
Type: fix Fixes: b4fff3a Change-Id: I2552cbc0a02e7445825a5a4ce290cde3d10c5f0b Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vnet/ipsec/esp_decrypt.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vnet/ipsec/esp_decrypt.c b/src/vnet/ipsec/esp_decrypt.c
index 8272bb0dbcb..710c8f17762 100644
--- a/src/vnet/ipsec/esp_decrypt.c
+++ b/src/vnet/ipsec/esp_decrypt.c
@@ -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 */