aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat66/nat66.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-07-16 07:54:10 +0000
committerOle Trøan <otroan@employees.org>2020-08-13 08:34:33 +0000
commitde118da58e80aec43f4b816a1ea957634a8bc07c (patch)
tree16de15d96990fdc6dd9eaf17be405daa2980d790 /src/plugins/nat/nat66/nat66.c
parentfbecd936bd40e590031ec6d7ff81c3f8827f9f18 (diff)
nat: remove non-error error counters
Some statistics counters were implemented as error counters. Move them to stat segment, where they belong. Type: improvement Change-Id: I5600bec1b4e0496282297374ec1e79d909cdaf8a Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat66/nat66.c')
-rw-r--r--src/plugins/nat/nat66/nat66.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/nat/nat66/nat66.c b/src/plugins/nat/nat66/nat66.c
index 36d5d733a6d..0a90f732b95 100644
--- a/src/plugins/nat/nat66/nat66.c
+++ b/src/plugins/nat/nat66/nat66.c
@@ -70,9 +70,22 @@ nat66_init (vlib_main_t * vm)
FIB_SOURCE_PRIORITY_HI,
FIB_SOURCE_BH_SIMPLE);
+ nm->in2out_packets.name = "in2out";
+ nm->in2out_packets.stat_segment_name = "/nat64/in2out";
+ nm->out2in_packets.name = "out2in";
+ nm->out2in_packets.stat_segment_name = "/nat64/out2in";
return nat66_plugin_api_hookup (vm);
}
+static void
+nat66_validate_counters (nat66_main_t * nm, u32 sw_if_index)
+{
+ vlib_validate_simple_counter (&nm->in2out_packets, sw_if_index);
+ vlib_zero_simple_counter (&nm->in2out_packets, sw_if_index);
+ vlib_validate_simple_counter (&nm->out2in_packets, sw_if_index);
+ vlib_zero_simple_counter (&nm->out2in_packets, sw_if_index);
+}
+
int
nat66_interface_add_del (u32 sw_if_index, u8 is_inside, u8 is_add)
{
@@ -101,6 +114,7 @@ nat66_interface_add_del (u32 sw_if_index, u8 is_inside, u8 is_add)
interface->flags =
is_inside ? NAT66_INTERFACE_FLAG_IS_INSIDE :
NAT66_INTERFACE_FLAG_IS_OUTSIDE;
+ nat66_validate_counters (nm, sw_if_index);
}
else
{