- return error;
-}
-
-static clib_error_t *
-nat64_set_timeouts_command_fn (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- nat64_main_t *nm = &nat64_main;
- unformat_input_t _line_input, *line_input = &_line_input;
- clib_error_t *error = 0;
- u32 timeout, tcp_trans, tcp_est, tcp_incoming_syn;
-
- tcp_trans = nat64_get_tcp_trans_timeout ();
- tcp_est = nat64_get_tcp_est_timeout ();
- tcp_incoming_syn = nat64_get_tcp_incoming_syn_timeout ();
-
- if (nm->is_disabled)
- return clib_error_return (0,
- "NAT64 disabled, multi thread not supported");
-
- if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (line_input, "udp %u", &timeout))
- {
- if (nat64_set_udp_timeout (timeout))
- {
- error = clib_error_return (0, "Invalid UDP timeout value");
- goto done;
- }
- }
- else if (unformat (line_input, "icmp %u", &timeout))
- {
- if (nat64_set_icmp_timeout (timeout))
- {
- error = clib_error_return (0, "Invalid ICMP timeout value");
- goto done;
- }
- }
- else if (unformat (line_input, "tcp-trans %u", &tcp_trans))
- {
- if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
- {
- error =
- clib_error_return (0, "Invalid TCP transitory tiemout value");
- goto done;
- }
- }
- else if (unformat (line_input, "tcp-est %u", &tcp_est))
- {
- if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
- {
- error =
- clib_error_return (0,
- "Invalid TCP established tiemout value");
- goto done;
- }
- }
- else
- if (unformat (line_input, "tcp-incoming-syn %u", &tcp_incoming_syn))
- {
- if (nat64_set_tcp_timeouts (tcp_trans, tcp_est, tcp_incoming_syn))
- {
- error =
- clib_error_return (0,
- "Invalid TCP incoming SYN tiemout value");
- goto done;
- }
- }
- else if (unformat (line_input, "reset"))
- {
- nat64_set_udp_timeout (0);
- nat64_set_icmp_timeout (0);
- nat64_set_tcp_timeouts (0, 0, 0);
- }
- else
- {
- error = clib_error_return (0, "unknown input '%U'",
- format_unformat_error, line_input);
- goto done;
- }
- }