42 if (0 == strcmp(auser->user_module_name, user_module_name)) {
43 return (auser - am->acl_users);
48 auser->user_module_name = user_module_name;
49 auser->val1_label = val1_label;
50 auser->val2_label = val2_label;
51 return (auser - am->acl_users);
104 return VNET_API_ERROR_INVALID_REGISTRATION;
121 return new_context_id;
137 for(i=0; i<
vec_len(acls); i++) {
151 clib_warning(
"BUG: can not unlock acl %d lc_index %d", acl, lc_index);
182 for(i=
vec_len(acls); i > 0; i--)
196 clib_warning(
"BUG: lc_index %d is not valid", lc_index);
221 uword *seen_acl_bitmap = 0;
228 for(i=0; i<
vec_len(acl_list); i++) {
233 clib_warning(
"BUG: lc_index %d is not valid", lc_index);
244 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
250 clib_warning (
"ERROR: ACL %d being applied twice", *pacln);
251 rv = VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
301 int is_ip6,
u8 * r_action,
304 u32 * r_rule_match_p,
320 u32 curr_user_index = (auser - am->acl_users);
321 if (user_index == ~0 || (curr_user_index == user_index)) {
322 vlib_cli_output (vm,
"index %d:%s:%s:%s", curr_user_index, auser->user_module_name, auser->val1_label, auser->val2_label);
343 u32 curr_lc_index = (acontext - am->acl_lookup_contexts);
344 if ((lc_index == ~0) || (curr_lc_index == lc_index)) {
345 if (acl_user_id_valid(am, acontext->context_user_id)) {
346 acl_lookup_context_user_t *auser = pool_elt_at_index(am->acl_users, acontext->context_user_id);
347 vlib_cli_output (vm,
"index %d:%s %s: %d %s: %d, acl_indices: %U",
348 curr_lc_index, auser->user_module_name, auser->val1_label,
349 acontext->user_val1, auser->val2_label, acontext->user_val2,
350 format_vec32, acontext->acl_indices,
"%d");
352 vlib_cli_output (vm,
"index %d: user_id: %d user_val1: %d user_val2: %d, acl_indices: %U",
353 curr_lc_index, acontext->context_user_id,
354 acontext->user_val1, acontext->user_val2,
355 format_vec32, acontext->acl_indices,
"%d");
370 #define _(name) m->name = acl_plugin_ ## name; #define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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)
clib_error_t * acl_plugin_methods_vtable_init(acl_plugin_methods_t *m)
#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).
static u32 acl_plugin_register_user_module(char *user_module_name, char *val1_label, char *val2_label)
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
static int acl_plugin_get_lookup_context_index(u32 acl_user_id, u32 val1, u32 val2)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void acl_plugin_put_lookup_context_index(u32 lc_index)
static u8 acl_plugin_acl_exists(u32 acl_index)
#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)
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
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 vec_del1(v, i)
Delete the element at index I.
#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 int acl_plugin_match_5tuple_inline(void *p_acl_main, 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)
static u32 get_acl_user_id(acl_main_t *am, char *user_module_name, char *val1_label, char *val2_label)
#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)
void acl_plugin_show_lookup_context(u32 lc_index)
#define clib_bitmap_free(v)
Free a bitmap.
#define foreach_acl_plugin_exported_method_name
void * acl_plugin_get_p_acl_main(void)
acl_lookup_context_t * acl_lookup_contexts
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
static void unlock_acl_vec(u32 lc_index, u32 *acls)
void * acl_plugin_set_heap()
#define vec_foreach(var, vec)
Vector iterator.
static int acl_user_id_valid(acl_main_t *am, u32 acl_user_id)
static int acl_plugin_set_acl_vec_for_context(u32 lc_index, u32 *acl_list)
static 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)
static void lock_acl_vec(u32 lc_index, u32 *acls)
static 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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
acl_lookup_context_user_t * acl_users
foreach_fa_cleaner_counter vlib_main_t * vlib_main