aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/policer
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/policer')
-rw-r--r--src/vnet/policer/node_funcs.c19
-rw-r--r--src/vnet/policer/policer.c13
2 files changed, 24 insertions, 8 deletions
diff --git a/src/vnet/policer/node_funcs.c b/src/vnet/policer/node_funcs.c
index 1f4997ff669..457dd09fd12 100644
--- a/src/vnet/policer/node_funcs.c
+++ b/src/vnet/policer/node_funcs.c
@@ -447,6 +447,7 @@ test_policer_command_fn (vlib_main_t * vm,
int rx_set = 0;
int is_add = 1;
int is_show = 0;
+ clib_error_t *error = NULL;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -468,7 +469,10 @@ test_policer_command_fn (vlib_main_t * vm,
}
if (rx_set == 0)
- return clib_error_return (0, "interface not set");
+ {
+ error = clib_error_return (0, "interface not set");
+ goto done;
+ }
if (is_show)
{
@@ -477,12 +481,13 @@ test_policer_command_fn (vlib_main_t * vm,
policer = pool_elt_at_index (pm->policers, pi);
vlib_cli_output (vm, "%U", format_policer_instance, policer);
- return 0;
+ goto done;
}
if (is_add && config_name == 0)
{
- return clib_error_return (0, "policer config name required");
+ error = clib_error_return (0, "policer config name required");
+ goto done;
}
rv = test_policer_add_del (rx_sw_if_index, config_name, is_add);
@@ -493,11 +498,15 @@ test_policer_command_fn (vlib_main_t * vm,
break;
default:
- return clib_error_return
+ error = clib_error_return
(0, "WARNING: vnet_vnet_policer_add_del returned %d", rv);
+ goto done;
}
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c
index 290a6af57e2..cd754e29be9 100644
--- a/src/vnet/policer/policer.c
+++ b/src/vnet/policer/policer.c
@@ -413,6 +413,7 @@ configure_policer_command_fn (vlib_main_t * vm,
u8 is_add = 1;
u8 *name = 0;
u32 pi;
+ clib_error_t *error = NULL;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -433,13 +434,19 @@ configure_policer_command_fn (vlib_main_t * vm,
foreach_config_param
#undef _
else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
+ error = policer_add_del (vm, name, &c, &pi, is_add);
+
+done:
unformat_free (line_input);
- return policer_add_del (vm, name, &c, &pi, is_add);
+ return error;
}
/* *INDENT-OFF* */