aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-03-04 08:52:54 -0500
committerDamjan Marion <dmarion@me.com>2019-03-04 14:56:42 +0000
commitc919982a0f877fc29099c925f64099288821420c (patch)
tree3ca04017de75cb4f93baacf8c6b41618b3e7d021
parentf159f58dbfc85f616b029c36196961915d7e52d2 (diff)
Fix 2x overconsumption of debug cli input bugs
Change-Id: I658489dc9cf437ff43d9c69a896c9fe4e01ec38e Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vnet/dhcp/dhcp6_ia_na_client_cp.c14
-rw-r--r--src/vnet/dhcp/dhcp6_pd_client_cp.c15
2 files changed, 20 insertions, 9 deletions
diff --git a/src/vnet/dhcp/dhcp6_ia_na_client_cp.c b/src/vnet/dhcp/dhcp6_ia_na_client_cp.c
index e83eecc17c3..ad0ca8e3e93 100644
--- a/src/vnet/dhcp/dhcp6_ia_na_client_cp.c
+++ b/src/vnet/dhcp/dhcp6_ia_na_client_cp.c
@@ -712,22 +712,28 @@ dhcp6_client_enable_disable_command_fn (vlib_main_t * vm,
clib_error_t *error = 0;
u32 sw_if_index = ~0;
u8 enable = 1;
+ unformat_input_t _line_input, *line_input = &_line_input;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat
- (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
+ (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
;
- else if (unformat (input, "disable"))
+ else if (unformat (line_input, "disable"))
enable = 0;
else
{
error = clib_error_return (0, "unexpected input `%U'",
- format_unformat_error, input);
+ format_unformat_error, line_input);
goto done;
}
}
+ unformat_free (line_input);
+
if (sw_if_index != ~0)
{
if (dhcp6_client_enable_disable (sw_if_index, enable) != 0)
diff --git a/src/vnet/dhcp/dhcp6_pd_client_cp.c b/src/vnet/dhcp/dhcp6_pd_client_cp.c
index 9663a5718ec..eb18ed2889a 100644
--- a/src/vnet/dhcp/dhcp6_pd_client_cp.c
+++ b/src/vnet/dhcp/dhcp6_pd_client_cp.c
@@ -1275,19 +1275,23 @@ dhcp6_pd_client_enable_disable_command_fn (vlib_main_t *
u8 *prefix_group = 0;
u32 sw_if_index = ~0;
u8 enable = 1;
+ unformat_input_t _line_input, *line_input = &_line_input;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat
- (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
+ (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
;
- else if (unformat (input, "prefix group %s", &prefix_group));
- else if (unformat (input, "disable"))
+ else if (unformat (line_input, "prefix group %s", &prefix_group));
+ else if (unformat (line_input, "disable"))
enable = 0;
else
{
error = clib_error_return (0, "unexpected input `%U'",
- format_unformat_error, input);
+ format_unformat_error, line_input);
goto done;
}
}
@@ -1305,6 +1309,7 @@ dhcp6_pd_client_enable_disable_command_fn (vlib_main_t *
done:
vec_free (prefix_group);
+ unformat_free (line_input);
return error;
}