32 if (0 == strcmp(auser->user_module_name, user_module_name)) {
33 return (auser - am->acl_users);
38 auser->user_module_name = user_module_name;
39 auser->val1_label = val1_label;
40 auser->val2_label = val2_label;
41 return (auser - am->acl_users);
90 return VNET_API_ERROR_INVALID_REGISTRATION;
105 return new_context_id;
121 for(i=0; i<
vec_len(acls); i++) {
135 clib_warning(
"BUG: can not unlock acl %d lc_index %d", acl, lc_index);
166 for(i=
vec_len(acls); i > 0; i--)
180 clib_warning(
"BUG: lc_index %d is not valid", lc_index);
205 uword *seen_acl_bitmap = 0;
212 for(i=0; i<
vec_len(acl_list); i++) {
217 clib_warning(
"BUG: lc_index %d is not valid", lc_index);
228 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
234 clib_warning (
"ERROR: ACL %d being applied twice", *pacln);
235 rv = VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
285 int is_ip6,
u8 * r_action,
288 u32 * r_rule_match_p,
304 u32 curr_user_index = (auser - am->acl_users);
305 if (user_index == ~0 || (curr_user_index == user_index)) {
306 vlib_cli_output (vm,
"index %d:%s:%s:%s", curr_user_index, auser->user_module_name, auser->val1_label, auser->val2_label);
327 u32 curr_lc_index = (acontext - am->acl_lookup_contexts);
328 if ((lc_index == ~0) || (curr_lc_index == lc_index)) {
329 if (acl_user_id_valid(am, acontext->context_user_id)) {
330 acl_lookup_context_user_t *auser = pool_elt_at_index(am->acl_users, acontext->context_user_id);
331 vlib_cli_output (vm,
"index %d:%s %s: %d %s: %d, acl_indices: %U",
332 curr_lc_index, auser->user_module_name, auser->val1_label,
333 acontext->user_val1, auser->val2_label, acontext->user_val2,
334 format_vec32, acontext->acl_indices,
"%d");
336 vlib_cli_output (vm,
"index %d: user_id: %d user_val1: %d user_val2: %d, acl_indices: %U",
337 curr_lc_index, acontext->context_user_id,
338 acontext->user_val1, acontext->user_val2,
339 format_vec32, acontext->acl_indices,
"%d");
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void acl_plugin_fill_5tuple(u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
static void unapply_acl_vec(u32 lc_index, u32 *acls)
void hash_acl_unapply(acl_main_t *am, u32 lc_index, int acl_index)
static void unlock_acl(acl_main_t *am, u32 acl, u32 lc_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void acl_plugin_lookup_context_notify_acl_change(u32 acl_num)
void hash_acl_add(acl_main_t *am, int acl_index)
u32 ** lc_index_vec_by_acl
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
int acl_plugin_set_acl_vec_for_context(u32 lc_index, u32 *acl_list)
#define elog_acl_cond_trace_X1(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args, acl_elog_val1)
static void lock_acl(acl_main_t *am, u32 acl, u32 lc_index)
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
static int acl_lc_index_valid(acl_main_t *am, u32 lc_index)
void hash_acl_apply(acl_main_t *am, u32 lc_index, int acl_index, u32 acl_position)
void acl_plugin_put_lookup_context_index(u32 lc_index)
int hash_acl_exists(acl_main_t *am, int acl_index)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void apply_acl_vec(u32 lc_index, u32 *acls)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
#define elog_acl_cond_trace_X2(am, trace_cond, acl_elog_trace_format_label, acl_elog_trace_format_args,acl_elog_val1, acl_elog_val2)
#define vec_del1(v, i)
Delete the element at index I.
int acl_plugin_get_lookup_context_index(u32 acl_user_id, u32 val1, u32 val2)
#define vec_free(V)
Free vector's memory (no header).
static void * clib_mem_set_heap(void *heap)
void hash_acl_delete(acl_main_t *am, int acl_index)
#define clib_warning(format, args...)
void acl_plugin_show_lookup_user(u32 user_index)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static u32 get_acl_user_id(acl_main_t *am, char *user_module_name, char *val1_label, char *val2_label)
static int acl_plugin_match_5tuple_inline(u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
void acl_plugin_show_lookup_context(u32 lc_index)
#define clib_bitmap_free(v)
Free a bitmap.
acl_lookup_context_t * acl_lookup_contexts
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void unlock_acl_vec(u32 lc_index, u32 *acls)
void * acl_plugin_set_heap()
u8 acl_plugin_acl_exists(u32 acl_index)
#define vec_foreach(var, vec)
Vector iterator.
static int acl_user_id_valid(acl_main_t *am, u32 acl_user_id)
static void lock_acl_vec(u32 lc_index, u32 *acls)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
acl_lookup_context_user_t * acl_users
static void acl_plugin_fill_5tuple_inline(u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
u32 acl_plugin_register_user_module(char *user_module_name, char *val1_label, char *val2_label)
foreach_fa_cleaner_counter vlib_main_t * vlib_main
int acl_plugin_match_5tuple(u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)