*/
#include <nat/det44/det44.h>
+#define DET44_EXPECTED_ARGUMENT "expected required argument(s)"
+
static clib_error_t *
det44_map_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
det44_main_t *dm = &det44_main;
snat_det_map_t *mp;
vlib_cli_output (vm, "NAT44 deterministic mappings:");
- /* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
vlib_cli_output (vm, " in %U/%d out %U/%d\n",
format_ip4_address, &mp->in_addr, mp->in_plen,
format_ip4_address, &mp->out_addr, mp->out_plen);
vlib_cli_output (vm, " number of ports per inside host: %d\n",
mp->ports_per_host);
vlib_cli_output (vm, " sessions number: %d\n", mp->ses_num);
- }));
- /* *INDENT-ON* */
+ }
return 0;
}
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
u32 out_port;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
snat_det_session_t *ses;
snat_det_map_t *mp;
vlib_cli_output (vm, "NAT44 deterministic sessions:");
- /* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps,
- ({
+ pool_foreach (mp, dm->det_maps)
+ {
int i;
vec_foreach_index (i, mp->sessions)
{
if (ses->in_port)
vlib_cli_output (vm, " %U", format_det_map_ses, mp, ses, &i);
}
- }));
- /* *INDENT-ON* */
+ }
return 0;
}
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
u8 reset = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
det44_config_t c = { 0 };
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
u8 is_del = 0;
if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
+ return clib_error_return (0, DET44_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
}
}
- /* *INDENT-OFF* */
vec_foreach (p, sw_if_indices)
{
if (det44_interface_add_del (p->sw_if_index, p->is_inside, is_del))
break;
}
}
- /* *INDENT-ON* */
done:
unformat_free (line_input);
vec_free (sw_if_indices);
det44_main_t *dm = &det44_main;
det44_interface_t *i;
vlib_cli_output (vm, "DET44 interfaces:");
- /* *INDENT-OFF* */
- pool_foreach (i, dm->interfaces,
- ({
+ pool_foreach (i, dm->interfaces)
+ {
vlib_cli_output (vm, " %U %s", format_vnet_sw_if_index_name, vnm,
i->sw_if_index,
(det44_interface_is_inside(i) &&
det44_interface_is_outside(i)) ? "in out" :
(det44_interface_is_inside(i) ? "in" : "out"));
- }));
- /* *INDENT-ON* */
+ }
return 0;
}
-/* *INDENT-OFF* */
/*?
* @cliexpar
* @cliexstart{det44 add}
"<in_addr>:<in_port> <ext_addr>:<ext_port>",
.function = det44_close_session_in_fn,
};
-/* *INDENT-ON* */
/*?
* @cliexpar
?*/
VLIB_CLI_COMMAND (det44_set_timeouts_command, static) =
{
-.path = "set det44 timeouts",.short_help =
- "set det44 timeouts <[udp <sec>] [tcp established <sec>] "
- "[tcp transitory <sec>] [icmp <sec>]|reset>",.function =
- det44_set_timeouts_command_fn,};
+ .path = "set det44 timeouts",
+ .short_help = "set det44 timeouts <[udp <sec>] [tcp established <sec>] "
+ "[tcp transitory <sec>] [icmp <sec>]|reset>",
+ .function = det44_set_timeouts_command_fn,
+};
/*?
* @cliexpar
?*/
VLIB_CLI_COMMAND (det44_show_timeouts_command, static) =
{
-.path = "show det44 timeouts",.short_help =
- "show det44 timeouts",.function = det44_show_timeouts_command_fn,};
+ .path = "show det44 timeouts",
+ .short_help = "show det44 timeouts",
+ .function = det44_show_timeouts_command_fn,
+};
/*?
* @cliexpar
?*/
VLIB_CLI_COMMAND (det44_plugin_enable_disable_command, static) =
{
-.path = "det44 plugin",.short_help =
- "det44 plugin <enable [inside vrf] [outside vrf]|disable>",.function =
- det44_plugin_enable_disable_command_fn,};
+ .path = "det44 plugin",
+ .short_help = "det44 plugin <enable [inside vrf] [outside vrf]|disable>",
+ .function = det44_plugin_enable_disable_command_fn,
+};
/*?
* @cliexpar
?*/
VLIB_CLI_COMMAND (det44_feature_command, static) =
{
-.path = "set interface det44",.short_help =
- "set interface det44 inside <intfc> outside <intfc> [del]",.function =
- det44_feature_command_fn,};
+ .path = "set interface det44",
+ .short_help = "set interface det44 inside <intfc> outside <intfc> [del]",
+ .function = det44_feature_command_fn,
+};
/*?
* @cliexpar
?*/
VLIB_CLI_COMMAND (det44_show_interfaces_command, static) =
{
-.path = "show det44 interfaces",.short_help =
- "show det44 interfaces",.function = det44_show_interfaces_command_fn,};
+ .path = "show det44 interfaces",
+ .short_help = "show det44 interfaces",
+ .function = det44_show_interfaces_command_fn,
+};
/*
* fd.io coding-style-patch-verification: ON