X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat44_cli.c;h=659dbb2247e14ceab5befa0c1cfaf07bf143a8ca;hb=8a10c7351b35ab8405c2a9b030dba74a4da28f30;hp=54a90fcf2ef48c87e009bfadbfa5cd7573fd796a;hpb=34931eb47124ef78a3aa9575930e848a78c9618b;p=vpp.git diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c index 54a90fcf2ef..659dbb2247e 100644 --- a/src/plugins/nat/nat44_cli.c +++ b/src/plugins/nat/nat44_cli.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -115,6 +116,51 @@ nat_show_workers_commnad_fn (vlib_main_t * vm, unformat_input_t * input, return 0; } +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) +{ + unformat_input_t _line_input, *line_input = &_line_input; + snat_main_t *sm = &snat_main; + u8 log_level = SNAT_LOG_NONE; + clib_error_t *error = 0; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + if (!unformat (line_input, "%d", &log_level)) + { + error = clib_error_return (0, "unknown input '%U'", + format_unformat_error, line_input); + goto done; + } + if (log_level > SNAT_LOG_DEBUG) + { + error = clib_error_return (0, "unknown logging level '%d'", log_level); + goto done; + } + sm->log_level = log_level; + +done: + unformat_free (line_input); + + return error; +} + static clib_error_t * snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input, @@ -368,7 +414,7 @@ nat_ha_failover_command_fn (vlib_main_t * vm, unformat_input_t * input, ; else if (unformat - (line_input, "refresh-intervval %u", &session_refresh_interval)) + (line_input, "refresh-interval %u", &session_refresh_interval)) ; else { @@ -449,7 +495,7 @@ nat_show_ha_command_fn (vlib_main_t * vm, unformat_input_t * input, nat_ha_get_failover (&addr, &port, &session_refresh_interval); vlib_cli_output (vm, "FAILOVER:\n"); if (port) - vlib_cli_output (vm, " %U:%u refresh-intervval %usec\n", + vlib_cli_output (vm, " %U:%u refresh-interval %usec\n", format_ip4_address, &addr, port, session_refresh_interval); else @@ -1943,6 +1989,32 @@ VLIB_CLI_COMMAND (nat_show_timeouts_command, static) = { .function = nat_show_timeouts_command_fn, }; +/*? + * @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 +?*/ +VLIB_CLI_COMMAND (snat_set_log_level_command, static) = { + .path = "nat set logging level", + .function = snat_set_log_level_command_fn, + .short_help = "nat set logging level ", +}; + /*? * @cliexpar * @cliexstart{snat ipfix logging} @@ -2024,7 +2096,7 @@ VLIB_CLI_COMMAND (nat_show_mss_clamping_command, static) = { ?*/ VLIB_CLI_COMMAND (nat_ha_failover_command, static) = { .path = "nat ha failover", - .short_help = "nat ha failover : [refresh-intervval ]", + .short_help = "nat ha failover : [refresh-interval ]", .function = nat_ha_failover_command_fn, }; @@ -2202,13 +2274,13 @@ VLIB_CLI_COMMAND (add_static_mapping_command, static) = { * To create identity mapping for address 10.0.0.3 use: * vpp# nat44 add identity mapping 10.0.0.3 * To create identity mapping for DHCP addressed interface use: - * vpp# nat44 add identity mapping GigabitEthernet0/a/0 tcp 3606 + * vpp# nat44 add identity mapping external GigabitEthernet0/a/0 tcp 3606 * @cliexend ?*/ VLIB_CLI_COMMAND (add_identity_mapping_command, static) = { .path = "nat44 add identity mapping", .function = add_identity_mapping_command_fn, - .short_help = "nat44 add identity mapping | " + .short_help = "nat44 add identity mapping |external " "[ ] [vrf ] [del]", };