- 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 timeouts 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 timeouts 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 timeouts 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;
- }
- }