summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat66/nat66.c
diff options
context:
space:
mode:
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
{