X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fipsec_sa.c;h=fc8520d5ebbe5772b14a133cb34702af4910f9fe;hb=eba31ecebed1a7d168da17194cab7a8955761f2b;hp=b0de76ac5086987dcca9be7bfd80f1b4b41844a5;hpb=b4cfd55f25cb87acff732fc40633d055cfedd816;p=vpp.git diff --git a/src/vnet/ipsec/ipsec_sa.c b/src/vnet/ipsec/ipsec_sa.c index b0de76ac508..fc8520d5ebb 100644 --- a/src/vnet/ipsec/ipsec_sa.c +++ b/src/vnet/ipsec/ipsec_sa.c @@ -16,6 +16,16 @@ #include #include +/** + * @brief + * SA packet & bytes counters + */ +vlib_combined_counter_main_t ipsec_sa_counters = { + .name = "SA", + .stat_segment_name = "/net/ipsec/sa", +}; + + static clib_error_t * ipsec_call_add_del_callbacks (ipsec_main_t * im, ipsec_sa_t * sa, u32 sa_index, int is_add) @@ -106,8 +116,12 @@ ipsec_sa_add (u32 id, fib_node_init (&sa->node, FIB_NODE_TYPE_IPSEC_SA); sa_index = sa - im->sad; + vlib_validate_combined_counter (&ipsec_sa_counters, sa_index); + vlib_zero_combined_counter (&ipsec_sa_counters, sa_index); + sa->id = id; sa->spi = spi; + sa->stat_index = sa_index; sa->protocol = proto; sa->crypto_alg = crypto_alg; clib_memcpy (&sa->crypto_key, ck, sizeof (sa->crypto_key)); @@ -272,7 +286,10 @@ ipsec_set_sa_key (u32 id, const ipsec_key_t * ck, const ipsec_key_t * ik) { err = ipsec_call_add_del_callbacks (im, sa, sa_index, 0); if (err) - return VNET_API_ERROR_SYSCALL_ERROR_1; + { + clib_error_free (err); + return VNET_API_ERROR_SYSCALL_ERROR_1; + } } return 0;