aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-05-17 10:46:40 -0400
committerDave Wallace <dwallacelf@gmail.com>2019-05-17 21:06:13 +0000
commit8fdde3c22ff981f0c41b78d3640e3249873e8495 (patch)
tree15016f3c45d2c9a7ec68863302820ee342445c13 /src/vnet/interface_cli.c
parentce5c2ce518346990d081e4e0c56070be4a743586 (diff)
Add a debug-CLI leak-checker
leak-check { <any-debug-cli-command-and-args> } Hint: "set term history off" or you'll have to sort through a bunch of bogus leaks related to the debug cli history mechanism. Cleaned up a set of reported leaks in the "show interface" command. At some point, we thought about making a per-thread vlib_mains vector, but we never did that. Several interface-related CLI's maintained local static cache vectors. Not a bad idea, but not useful as things shook out. Removed the static vectors. Change-Id: I756bf2721a0d91993ecfded34c79da406f30a548 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/interface_cli.c')
-rw-r--r--src/vnet/interface_cli.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 624f8ef0c13..f990cdeeb5d 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -304,6 +304,7 @@ show_sw_interfaces (vlib_main_t * vm,
verbose = 1;
else
{
+ vec_free (sorted_sis);
error = clib_error_return (0, "unknown input `%U'",
format_unformat_error, linput);
goto done;
@@ -314,7 +315,10 @@ show_sw_interfaces (vlib_main_t * vm,
if (show_features || show_tag)
{
if (sw_if_index == ~(u32) 0)
- return clib_error_return (0, "Interface not specified...");
+ {
+ vec_free (sorted_sis);
+ return clib_error_return (0, "Interface not specified...");
+ }
}
if (show_features)
@@ -335,6 +339,7 @@ show_sw_interfaces (vlib_main_t * vm,
vlib_cli_output (vm, "%10s (%s)", "VTR", "--internal--");
vlib_cli_output (vm, "%U", format_l2_output_features,
l2_output->feature_bitmap, 1);
+ vec_free (sorted_sis);
return 0;
}
if (show_tag)
@@ -344,6 +349,7 @@ show_sw_interfaces (vlib_main_t * vm,
vlib_cli_output (vm, "%U: %s",
format_vnet_sw_if_index_name, vnm, sw_if_index,
tag ? (char *) tag : "(none)");
+ vec_free (sorted_sis);
return 0;
}
@@ -497,42 +503,24 @@ clear_interface_counters (vlib_main_t * vm,
vnet_interface_main_t *im = &vnm->interface_main;
vlib_simple_counter_main_t *sm;
vlib_combined_counter_main_t *cm;
- static vnet_main_t **my_vnet_mains;
- int i, j, n_counters;
-
- vec_reset_length (my_vnet_mains);
-
- for (i = 0; i < vec_len (vnet_mains); i++)
- {
- if (vnet_mains[i])
- vec_add1 (my_vnet_mains, vnet_mains[i]);
- }
-
- if (vec_len (vnet_mains) == 0)
- vec_add1 (my_vnet_mains, vnm);
+ int j, n_counters;
n_counters = vec_len (im->combined_sw_if_counters);
for (j = 0; j < n_counters; j++)
{
- for (i = 0; i < vec_len (my_vnet_mains); i++)
- {
- im = &my_vnet_mains[i]->interface_main;
- cm = im->combined_sw_if_counters + j;
- vlib_clear_combined_counters (cm);
- }
+ im = &vnm->interface_main;
+ cm = im->combined_sw_if_counters + j;
+ vlib_clear_combined_counters (cm);
}
n_counters = vec_len (im->sw_if_counters);
for (j = 0; j < n_counters; j++)
{
- for (i = 0; i < vec_len (my_vnet_mains); i++)
- {
- im = &my_vnet_mains[i]->interface_main;
- sm = im->sw_if_counters + j;
- vlib_clear_simple_counters (sm);
- }
+ im = &vnm->interface_main;
+ sm = im->sw_if_counters + j;
+ vlib_clear_simple_counters (sm);
}
return 0;