summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44_cli.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-02-06 15:25:27 +0100
committerOle Trøan <otroan@employees.org>2020-02-07 07:37:05 +0000
commitedf777272b211de3d54f5dc7b211ee84cdb31373 (patch)
treeac18fd5190adb5d7090fdae80a9a296f048d8d80 /src/plugins/nat/nat44_cli.c
parentb71ef86c7429e81921997e54a526bf666a2e4089 (diff)
nat: api & cli command for forcing session cleanup
Ticket: VPP-1836 Type: feature Signed-off-by: Filip Varga <fivarga@cisco.com> Change-Id: I8f7fc011bac435445a8916a4948d130ca9162f67
Diffstat (limited to 'src/plugins/nat/nat44_cli.c')
-rw-r--r--src/plugins/nat/nat44_cli.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c
index e9d3ff5426f..659dbb2247e 100644
--- a/src/plugins/nat/nat44_cli.c
+++ b/src/plugins/nat/nat44_cli.c
@@ -22,6 +22,7 @@
#include <nat/nat_det.h>
#include <nat/nat64.h>
#include <nat/nat_inlines.h>
+#include <nat/nat44/inlines.h>
#include <nat/nat_affinity.h>
#include <vnet/fib/fib_table.h>
#include <nat/nat_ha.h>
@@ -116,6 +117,18 @@ nat_show_workers_commnad_fn (vlib_main_t * vm, unformat_input_t * input,
}
static clib_error_t *
+nat44_session_cleanup_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ clib_error_t *error = 0;
+
+ nat44_force_session_cleanup ();
+
+ return error;
+}
+
+static clib_error_t *
snat_set_log_level_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
@@ -1979,6 +1992,19 @@ VLIB_CLI_COMMAND (nat_show_timeouts_command, static) = {
/*?
* @cliexpar
* @cliexstart{nat set logging level}
+ * To force garbage collection of nat sessions
+ * vpp# nat44 session cleanup
+ * @cliexend
+?*/
+VLIB_CLI_COMMAND (nat44_session_cleanup_command, static) = {
+ .path = "nat44 session cleanup",
+ .function = nat44_session_cleanup_command_fn,
+ .short_help = "nat44 session cleanup",
+};
+
+/*?
+ * @cliexpar
+ * @cliexstart{nat set logging level}
* To set NAT logging level use:
* Set nat logging level
* @cliexend