{
acl_lookup_context_user_t *auser;
- pool_foreach (auser, am->acl_users,
- ({
+ pool_foreach (auser, am->acl_users)
+ {
if (0 == strcmp(auser->user_module_name, user_module_name)) {
return (auser - am->acl_users);
}
- }));
+ }
pool_get(am->acl_users, auser);
auser->user_module_name = user_module_name;
static u32 acl_plugin_register_user_module (char *user_module_name, char *val1_label, char *val2_label)
{
acl_main_t *am = &acl_main;
- void *oldheap = acl_plugin_set_heap();
+ /*
+ * Because folks like to call this early on,
+ * use the global heap, so as to avoid
+ * initializing the main ACL heap before
+ * they start using ACLs.
+ */
u32 user_id = get_acl_user_id(am, user_module_name, val1_label, val2_label);
- clib_mem_set_heap (oldheap);
return user_id;
}
if (!acl_user_id_valid(am, acl_user_id))
return VNET_API_ERROR_INVALID_REGISTRATION;
- void *oldheap = acl_plugin_set_heap ();
-
+ /*
+ * The lookup context index allocation is
+ * an operation done within the global heap,
+ * so no heap switching necessary.
+ */
pool_get(am->acl_lookup_contexts, acontext);
acontext->acl_indices = 0;
u32 new_context_id = acontext - am->acl_lookup_contexts;
vec_add1(am->acl_users[acl_user_id].lookup_contexts, new_context_id);
- clib_mem_set_heap (oldheap);
return new_context_id;
}
/*
* Release the lookup context index and destroy
- * any asssociated data structures.
+ * any associated data structures.
*/
static void acl_plugin_put_lookup_context_index (u32 lc_index)
{
return;
}
- void *oldheap = acl_plugin_set_heap ();
acl_lookup_context_t *acontext = pool_elt_at_index(am->acl_lookup_contexts, lc_index);
u32 index = vec_search(am->acl_users[acontext->context_user_id].lookup_contexts, lc_index);
unlock_acl_vec(lc_index, acontext->acl_indices);
vec_free(acontext->acl_indices);
pool_put(am->acl_lookup_contexts, acontext);
- clib_mem_set_heap (oldheap);
}
/*
clib_warning("BUG: lc_index %d is not valid", lc_index);
return -1;
}
- void *oldheap = acl_plugin_set_heap ();
-
vec_foreach (pacln, acl_list)
{
if (pool_is_free_index (am->acls, *pacln))
done:
clib_bitmap_free (seen_acl_bitmap);
- clib_mem_set_heap (oldheap);
return rv;
}
vlib_main_t *vm = am->vlib_main;
acl_lookup_context_user_t *auser;
- pool_foreach (auser, am->acl_users,
- ({
+ pool_foreach (auser, am->acl_users)
+ {
u32 curr_user_index = (auser - am->acl_users);
if (user_index == ~0 || (curr_user_index == user_index)) {
vlib_cli_output (vm, "index %d:%s:%s:%s", curr_user_index, auser->user_module_name, auser->val1_label, auser->val2_label);
}
- }));
+ }
}
return;
}
- pool_foreach (acontext, am->acl_lookup_contexts,
- ({
+ pool_foreach (acontext, am->acl_lookup_contexts)
+ {
u32 curr_lc_index = (acontext - am->acl_lookup_contexts);
if ((lc_index == ~0) || (curr_lc_index == lc_index)) {
if (acl_user_id_valid(am, acontext->context_user_id)) {
format_vec32, acontext->acl_indices, "%d");
}
}
- }));
+ }
}
void *
return &acl_main;
}
-clib_error_t *acl_plugin_methods_vtable_init(acl_plugin_methods_t *m)
+__clib_export clib_error_t *
+acl_plugin_methods_vtable_init(acl_plugin_methods_t *m)
{
m->p_acl_main = &acl_main;
-#define _(name) m->name = acl_plugin_ ## name; clib_warning("Setting method " #name " to %p\n", acl_plugin_ ## name);
+#define _(name) m->name = acl_plugin_ ## name;
foreach_acl_plugin_exported_method_name
#undef _
return 0;