From 18bde8a579960aa46f43ffbe5c2905774bd81a35 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Tue, 17 Apr 2018 11:40:54 +0200 Subject: acl-plugin: VPP-1241: fix the "show acl-plugin tables applied" output It is a relatively rarely used low level command for code that didn't change, but due to infra changes it did not survive. Having it working may be very useful for corner-case debugging. So, fix it for working with the acl-as-a-service infra. Change-Id: I11b60e0c78591cc340b043ec240f0311ea1eb2f9 Signed-off-by: Andrew Yourtchenko --- src/plugins/acl/acl.c | 8 +++--- src/plugins/acl/hash_lookup.c | 57 ++++++++++++------------------------------- 2 files changed, 20 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index 7d3a8527eac..ddbd51c7d63 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -3937,7 +3937,7 @@ acl_show_aclplugin_tables_fn (vlib_main_t * vm, clib_error_t *error = 0; u32 acl_index = ~0; - u32 sw_if_index = ~0; + u32 lc_index = ~0; int show_acl_hash_info = 0; int show_applied_info = 0; int show_mask_type = 0; @@ -3954,7 +3954,7 @@ acl_show_aclplugin_tables_fn (vlib_main_t * vm, else if (unformat (input, "applied")) { show_applied_info = 1; - unformat (input, "sw_if_index %u", &sw_if_index); + unformat (input, "lc_index %u", &lc_index); } else if (unformat (input, "mask")) { @@ -3981,7 +3981,7 @@ acl_show_aclplugin_tables_fn (vlib_main_t * vm, if (show_acl_hash_info) acl_plugin_show_tables_acl_hash_info (acl_index); if (show_applied_info) - acl_plugin_show_tables_applied_info (sw_if_index); + acl_plugin_show_tables_applied_info (lc_index); if (show_bihash) acl_plugin_show_tables_bihash (show_bihash_verbose); @@ -4050,7 +4050,7 @@ VLIB_CLI_COMMAND (aclplugin_show_sessions_command, static) = { VLIB_CLI_COMMAND (aclplugin_show_tables_command, static) = { .path = "show acl-plugin tables", - .short_help = "show acl-plugin tables [ acl [index N] | applied [ sw_if_index N ] | mask | hash [verbose N] ]", + .short_help = "show acl-plugin tables [ acl [index N] | applied [ lc_index N ] | mask | hash [verbose N] ]", .function = acl_show_aclplugin_tables_fn, }; diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c index f706bad634c..9a280031fc8 100644 --- a/src/plugins/acl/hash_lookup.c +++ b/src/plugins/acl/hash_lookup.c @@ -831,67 +831,42 @@ acl_plugin_print_pae (vlib_main_t * vm, int j, applied_hash_ace_entry_t * pae) } void -acl_plugin_show_tables_applied_info (u32 sw_if_index) +acl_plugin_show_tables_applied_info (u32 lc_index) { acl_main_t *am = &acl_main; vlib_main_t *vm = am->vlib_main; - u32 swi; //, j; - vlib_cli_output (vm, "Applied lookup entries for interfaces"); + u32 lci, j; + vlib_cli_output (vm, "Applied lookup entries for lookup contexts"); - for (swi = 0; - (swi < vec_len (am->input_lc_index_by_sw_if_index)) - || (swi < vec_len (am->output_lc_index_by_sw_if_index)); swi++) + for (lci = 0; + (lci < vec_len(am->applied_hash_acl_info_by_lc_index)); lci++) { - if ((sw_if_index != ~0) && (sw_if_index != swi)) + if ((lc_index != ~0) && (lc_index != lci)) { continue; } -/* - vlib_cli_output (vm, "sw_if_index %d:", swi); - if (swi < vec_len (am->input_applied_hash_acl_info_by_sw_if_index)) + vlib_cli_output (vm, "lc_index %d:", lci); + if (lci < vec_len (am->applied_hash_acl_info_by_lc_index)) { applied_hash_acl_info_t *pal = - &am->input_applied_hash_acl_info_by_sw_if_index[swi]; - vlib_cli_output (vm, " input lookup mask_type_index_bitmap: %U", + &am->applied_hash_acl_info_by_lc_index[lci]; + vlib_cli_output (vm, " lookup mask_type_index_bitmap: %U", format_bitmap_hex, pal->mask_type_index_bitmap); - vlib_cli_output (vm, " input applied acls: %U", format_vec32, + vlib_cli_output (vm, " applied acls: %U", format_vec32, pal->applied_acls, "%d"); } - if (swi < vec_len (am->input_hash_entry_vec_by_sw_if_index)) + if (lci < vec_len (am->hash_entry_vec_by_lc_index)) { - vlib_cli_output (vm, " input lookup applied entries:"); + vlib_cli_output (vm, " lookup applied entries:"); for (j = 0; - j < vec_len (am->input_hash_entry_vec_by_sw_if_index[swi]); + j < vec_len (am->hash_entry_vec_by_lc_index[lci]); j++) { acl_plugin_print_pae (vm, j, - &am->input_hash_entry_vec_by_sw_if_index - [swi][j]); + &am->hash_entry_vec_by_lc_index + [lci][j]); } } - - if (swi < vec_len (am->output_applied_hash_acl_info_by_sw_if_index)) - { - applied_hash_acl_info_t *pal = - &am->output_applied_hash_acl_info_by_sw_if_index[swi]; - vlib_cli_output (vm, " output lookup mask_type_index_bitmap: %U", - format_bitmap_hex, pal->mask_type_index_bitmap); - vlib_cli_output (vm, " output applied acls: %U", format_vec32, - pal->applied_acls, "%d"); - } - if (swi < vec_len (am->output_hash_entry_vec_by_sw_if_index)) - { - vlib_cli_output (vm, " output lookup applied entries:"); - for (j = 0; - j < vec_len (am->output_hash_entry_vec_by_sw_if_index[swi]); - j++) - { - acl_plugin_print_pae (vm, j, - &am->output_hash_entry_vec_by_sw_if_index - [swi][j]); - } - } -*/ } } -- cgit 1.2.3-korg