diff options
author | Matthew Smith <mgsmith@netgate.com> | 2017-05-16 11:51:18 -0500 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-05-17 09:45:21 +0000 |
commit | 01034be6738b9bd072a3d3cfdeb1b900aac2b54f (patch) | |
tree | 24bba388d5bda1c44192b108897da1580de61e8d /src/vnet/ipsec/ipsec_if.c | |
parent | 0218ff9f833033f21f8a58880de44db632d3a3bb (diff) |
Use counters on ipsec tunnel interfaces
Increment byte & packet counters when packets are sent or received on an
IPsec tunnel interface. Set counters to zero when the interface is deleted.
Change-Id: Ie9584aa82778875dd4d0c931005f7720b4d5c76d
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_if.c')
-rw-r--r-- | src/vnet/ipsec/ipsec_if.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vnet/ipsec/ipsec_if.c b/src/vnet/ipsec/ipsec_if.c index 9b0eb5b2779..1928e5ac200 100644 --- a/src/vnet/ipsec/ipsec_if.c +++ b/src/vnet/ipsec/ipsec_if.c @@ -220,6 +220,8 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, } else { + vnet_interface_main_t *vim = &vnm->interface_main; + /* check if exists */ if (!p) return VNET_API_ERROR_INVALID_VALUE; @@ -229,6 +231,13 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, vnet_sw_interface_set_flags (vnm, hi->sw_if_index, 0); /* admin down */ vec_add1 (im->free_tunnel_if_indices, t->hw_if_index); + vnet_interface_counter_lock (vim); + vlib_zero_combined_counter (vim->combined_sw_if_counters + + VNET_INTERFACE_COUNTER_TX, hi->sw_if_index); + vlib_zero_combined_counter (vim->combined_sw_if_counters + + VNET_INTERFACE_COUNTER_RX, hi->sw_if_index); + vnet_interface_counter_unlock (vim); + /* delete input and output SA */ sa = pool_elt_at_index (im->sad, t->input_sa_index); |