summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2018-03-26 12:30:47 +0200
committerOle Trøan <otroan@employees.org>2018-03-26 12:55:57 +0000
commite1e995db55be2fe1cb371fb6acd86ea9144da914 (patch)
treecdd74a8a8214e84a9ade88b7a97bb113cafe8efa /src/plugins/acl
parent06bc26077c59c26afb8a6ab44d274e98efbbba95 (diff)
acl-plugin: defer the ACL plugin user module registration with ACL lookup until it is needed
Registering ACL plugin user module within the "ACL as a service" infra during the plugin init causes an unnecesary ACL heap allocation and prevents the changing of the ACL heap size from the startup config. Defer this registration until just before it is needed - i.e. when applying an ACL to an interface. Change-Id: Ied79967596b3b76d6630f136c998e59f8cdad962 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins/acl')
-rw-r--r--src/plugins/acl/acl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index 57940fcccd7..7499bc4e106 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -1259,6 +1259,10 @@ acl_interface_set_inout_acl_list (acl_main_t * am, u32 sw_if_index,
u32 lc_index = (*pinout_lc_index_by_sw_if_index)[sw_if_index];
if (~0 == lc_index)
{
+ if (~0 == am->interface_acl_user_id)
+ am->interface_acl_user_id =
+ acl_plugin_register_user_module ("interface ACL", "sw_if_index",
+ "is_input");
lc_index =
acl_plugin_get_lookup_context_index (am->interface_acl_user_id,
sw_if_index, is_input);
@@ -4089,9 +4093,7 @@ acl_init (vlib_main_t * vm)
/* use the new fancy hash-based matching */
am->use_hash_acl_matching = 1;
- am->interface_acl_user_id =
- acl_plugin_register_user_module ("interface ACL", "sw_if_index",
- "is_input");
+ am->interface_acl_user_id = ~0; /* defer till the first use */
return error;
}