ip: fix punt cli to only consumes a line of input
Type: fix Change-Id: Idb6f82e08b29e3805ed2133acb5fd7226148f672 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 9ae3c6a40f268741b87f94a5b75f1b5d1d2128e3)
This commit is contained in:
Benoît Ganne
committed by
Andrew Yourtchenko
parent
b2d6edce86
commit
f3e7275743
@ -424,8 +424,9 @@ vnet_punt_add_del (vlib_main_t * vm, const punt_reg_t * pr, bool is_add)
|
|||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
punt_cli (vlib_main_t * vm,
|
punt_cli (vlib_main_t * vm,
|
||||||
unformat_input_t * input, vlib_cli_command_t * cmd)
|
unformat_input_t * input__, vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
|
unformat_input_t line_input, *input = &line_input;
|
||||||
clib_error_t *error = NULL;
|
clib_error_t *error = NULL;
|
||||||
bool is_add = true;
|
bool is_add = true;
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
@ -442,6 +443,9 @@ punt_cli (vlib_main_t * vm,
|
|||||||
u32 port;
|
u32 port;
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
if (!unformat_user (input__, unformat_line_input, input))
|
||||||
|
return 0;
|
||||||
|
|
||||||
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
{
|
{
|
||||||
if (unformat (input, "del"))
|
if (unformat (input, "del"))
|
||||||
@ -476,6 +480,7 @@ punt_cli (vlib_main_t * vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
unformat_free (input);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,8 +514,10 @@ VLIB_CLI_COMMAND (punt_command, static) = {
|
|||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
punt_socket_register_cmd (vlib_main_t * vm,
|
punt_socket_register_cmd (vlib_main_t * vm,
|
||||||
unformat_input_t * input, vlib_cli_command_t * cmd)
|
unformat_input_t * input__,
|
||||||
|
vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
|
unformat_input_t line_input, *input = &line_input;
|
||||||
u8 *socket_name = 0;
|
u8 *socket_name = 0;
|
||||||
clib_error_t *error = NULL;
|
clib_error_t *error = NULL;
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
@ -526,6 +533,9 @@ punt_socket_register_cmd (vlib_main_t * vm,
|
|||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
if (!unformat_user (input__, unformat_line_input, input))
|
||||||
|
return 0;
|
||||||
|
|
||||||
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
{
|
{
|
||||||
if (unformat (input, "ipv4"))
|
if (unformat (input, "ipv4"))
|
||||||
@ -556,6 +566,7 @@ punt_socket_register_cmd (vlib_main_t * vm,
|
|||||||
error = vnet_punt_socket_add (vm, 1, &pr, (char *) socket_name);
|
error = vnet_punt_socket_add (vm, 1, &pr, (char *) socket_name);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
unformat_free (input);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,9 +588,10 @@ VLIB_CLI_COMMAND (punt_socket_register_command, static) =
|
|||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
punt_socket_deregister_cmd (vlib_main_t * vm,
|
punt_socket_deregister_cmd (vlib_main_t * vm,
|
||||||
unformat_input_t * input,
|
unformat_input_t * input__,
|
||||||
vlib_cli_command_t * cmd)
|
vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
|
unformat_input_t line_input, *input = &line_input;
|
||||||
clib_error_t *error = NULL;
|
clib_error_t *error = NULL;
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
punt_reg_t pr = {
|
punt_reg_t pr = {
|
||||||
@ -594,6 +606,9 @@ punt_socket_deregister_cmd (vlib_main_t * vm,
|
|||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
if (!unformat_user (input__, unformat_line_input, input))
|
||||||
|
return 0;
|
||||||
|
|
||||||
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
{
|
{
|
||||||
if (unformat (input, "ipv4"))
|
if (unformat (input, "ipv4"))
|
||||||
@ -618,6 +633,7 @@ punt_socket_deregister_cmd (vlib_main_t * vm,
|
|||||||
|
|
||||||
error = vnet_punt_socket_del (vm, &pr);
|
error = vnet_punt_socket_del (vm, &pr);
|
||||||
done:
|
done:
|
||||||
|
unformat_free (input);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,13 +739,17 @@ punt_client_show_one (const punt_client_t * pc, void *ctx)
|
|||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
punt_socket_show_cmd (vlib_main_t * vm,
|
punt_socket_show_cmd (vlib_main_t * vm,
|
||||||
unformat_input_t * input, vlib_cli_command_t * cmd)
|
unformat_input_t * input__, vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
|
unformat_input_t line_input, *input = &line_input;
|
||||||
clib_error_t *error = NULL;
|
clib_error_t *error = NULL;
|
||||||
punt_type_t pt;
|
punt_type_t pt;
|
||||||
|
|
||||||
pt = PUNT_TYPE_L4;
|
pt = PUNT_TYPE_L4;
|
||||||
|
|
||||||
|
if (!unformat_user (input__, unformat_line_input, input))
|
||||||
|
return 0;
|
||||||
|
|
||||||
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
{
|
{
|
||||||
if (unformat (input, "exception"))
|
if (unformat (input, "exception"))
|
||||||
@ -749,6 +769,7 @@ punt_socket_show_cmd (vlib_main_t * vm,
|
|||||||
punt_client_walk (pt, punt_client_show_one, vm);
|
punt_client_walk (pt, punt_client_show_one, vm);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
unformat_free (input);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user