diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-08-15 12:26:17 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-08-16 19:54:39 +0000 |
commit | c02924ec6ebe0aa8e4903c6ca2cc0bf6c36da8cb (patch) | |
tree | 250105b8cbd9759ddffbdd08c65b51c5b2383946 /src/plugins/acl/acl.c | |
parent | 5cd987dda679fe50b9cd7a834bb9162db39ade78 (diff) |
acl: fix stats-segment counters validation on acl update
The stats-segment validation/clear logic for acl counters was wrong,
fix it. Also add the code to the unittests to cover that case,
add a vat command to enable/disable counters, clean up
the unnecessary endian conversion and remove the stray clib_warning()
Change-Id: I421297a92e4aeb885c468c72a97cec25981df615
Type: fix
Ticket: VPP-1744
Fixes: f995c7122ba0d024b17bc3232e8edd18d5e25088
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
(cherry picked from commit 4c945dacb9ff9da731301feb26b1edb4ac00e8bd)
Diffstat (limited to 'src/plugins/acl/acl.c')
-rw-r--r-- | src/plugins/acl/acl.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index 24dd53bd749..6b120563c9b 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -391,14 +391,19 @@ validate_and_reset_acl_counters (acl_main_t * am, u32 acl_index) /* filled in once only */ am->combined_acl_counters[i].stat_segment_name = (void *) format (0, "/acl/%d/matches%c", i, 0); - clib_warning ("add stats segment: %s", - am->combined_acl_counters[i].stat_segment_name); - i32 rule_count = vec_len (am->acls[acl_index].rules); + i32 rule_count = vec_len (am->acls[i].rules); /* Validate one extra so we always have at least one counter for an ACL */ vlib_validate_combined_counter (&am->combined_acl_counters[i], rule_count); - vlib_zero_combined_counter (&am->combined_acl_counters[i], rule_count); + vlib_clear_combined_counters (&am->combined_acl_counters[i]); } + + /* (re)validate for the actual ACL that is getting added/updated */ + i32 rule_count = vec_len (am->acls[acl_index].rules); + /* Validate one extra so we always have at least one counter for an ACL */ + vlib_validate_combined_counter (&am->combined_acl_counters[acl_index], + rule_count); + vlib_clear_combined_counters (&am->combined_acl_counters[acl_index]); acl_plugin_counter_unlock (am); } @@ -1945,7 +1950,7 @@ static void vl_api_acl_stats_intf_counters_enable_reply_t *rmp; int rv; - rv = acl_stats_intf_counters_enable_disable (am, ntohl (mp->enable)); + rv = acl_stats_intf_counters_enable_disable (am, mp->enable); REPLY_MACRO (VL_API_ACL_DEL_REPLY); } |