36 s =
format (s,
"%s: sw_if_index %d, next_index %d, table %d, offset %d",
37 is_output ?
"OUTACL" :
"INACL",
59 #define foreach_ip_inacl_error \ 60 _(MISS, "input ACL misses") \ 61 _(HIT, "input ACL hits") \ 62 _(CHAIN_HIT, "input ACL hits after chain walk") 64 #define foreach_ip_outacl_error \ 65 _(MISS, "output ACL misses") \ 66 _(HIT, "output ACL hits") \ 67 _(CHAIN_HIT, "output ACL hits after chain walk") 71 #define _(sym,str) IP_INACL_ERROR_##sym, 79 #define _(sym,string) string, 86 #define _(sym,str) IP_OUTACL_ERROR_##sym, 94 #define _(sym,string) string, 102 u16 * next,
u32 n_left,
int is_ip4,
int is_output,
170 h[2] +=
vnet_buffer (b[0])->l2_classify.pad.l2_len;
176 h[3] +=
vnet_buffer (b[1])->l2_classify.pad.l2_len;
185 vnet_buffer (b[0])->l2_classify.table_index = table_index[2];
186 vnet_buffer (b[1])->l2_classify.table_index = table_index[3];
199 vnet_classify_entry_t *e[2] = { 0, 0 };
208 sw_if_index[0] = sw_if_index[2];
209 sw_if_index[1] = sw_if_index[3];
211 table_index[0] = table_index[2];
212 table_index[1] = table_index[3];
265 h[2] +=
vnet_buffer (b[2])->l2_classify.pad.l2_len;
271 h[3] +=
vnet_buffer (b[3])->l2_classify.pad.l2_len;
280 vnet_buffer (b[2])->l2_classify.table_index = table_index[2];
281 vnet_buffer (b[3])->l2_classify.table_index = table_index[3];
309 = e[0]->opaque_index;
312 _next[0] = (e[0]->next_index < n_next_nodes) ?
313 e[0]->next_index : _next[0];
319 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
320 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
323 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
324 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
347 t[0]->miss_next_index : _next[0];
353 (is_output ? IP4_ERROR_OUTACL_TABLE_MISS :
354 IP4_ERROR_INACL_TABLE_MISS) : IP4_ERROR_NONE;
357 (is_output ? IP6_ERROR_OUTACL_TABLE_MISS :
358 IP6_ERROR_INACL_TABLE_MISS) : IP6_ERROR_NONE;
372 h[0] +=
vnet_buffer (b[0])->l2_classify.pad.l2_len;
382 = e[0]->opaque_index;
384 _next[0] = (e[0]->next_index < n_next_nodes) ?
385 e[0]->next_index : _next[0];
391 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
392 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
395 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
396 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
425 = e[1]->opaque_index;
428 _next[1] = (e[1]->next_index < n_next_nodes) ?
429 e[1]->next_index : _next[1];
435 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
436 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
439 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
440 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
463 t[1]->miss_next_index : _next[1];
469 (is_output ? IP4_ERROR_OUTACL_TABLE_MISS :
470 IP4_ERROR_INACL_TABLE_MISS) : IP4_ERROR_NONE;
473 (is_output ? IP6_ERROR_OUTACL_TABLE_MISS :
474 IP6_ERROR_INACL_TABLE_MISS) : IP6_ERROR_NONE;
488 h[1] +=
vnet_buffer (b[1])->l2_classify.pad.l2_len;
498 = e[1]->opaque_index;
500 _next[1] = (e[1]->next_index < n_next_nodes) ?
501 e[1]->next_index : _next[1];
507 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
508 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
511 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
512 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
534 if (do_trace && b[0]->
flags & VLIB_BUFFER_IS_TRACED)
546 if (do_trace && b[1]->
flags & VLIB_BUFFER_IS_TRACED)
558 if ((_next[0] == ACL_NEXT_INDEX_DENY) && is_output)
564 if ((_next[1] == ACL_NEXT_INDEX_DENY) && is_output)
585 vnet_classify_entry_t *e0 = 0;
615 vnet_buffer (b[0])->l2_classify.table_index = table_index0;
641 vnet_buffer (b[0])->l2_classify.opaque_index = e0->opaque_index;
644 next0 = (e0->next_index < n_next_nodes) ?
645 e0->next_index : next0;
651 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
652 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
655 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
656 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
684 (is_output ? IP4_ERROR_OUTACL_TABLE_MISS :
685 IP4_ERROR_INACL_TABLE_MISS) : IP4_ERROR_NONE;
688 (is_output ? IP6_ERROR_OUTACL_TABLE_MISS :
689 IP6_ERROR_INACL_TABLE_MISS) : IP6_ERROR_NONE;
707 (t0, (
u8 *) h0, hash0, now);
713 next0 = (e0->next_index < n_next_nodes) ?
714 e0->next_index : next0;
719 (is_output ? IP4_ERROR_OUTACL_SESSION_DENY :
720 IP4_ERROR_INACL_SESSION_DENY) : IP4_ERROR_NONE;
723 (is_output ? IP6_ERROR_OUTACL_SESSION_DENY :
724 IP6_ERROR_INACL_SESSION_DENY) : IP6_ERROR_NONE;
745 if (do_trace && b[0]->
flags & VLIB_BUFFER_IS_TRACED)
771 is_output ? IP_OUTACL_ERROR_MISS :
772 IP_INACL_ERROR_MISS, misses);
774 is_output ? IP_OUTACL_ERROR_HIT :
775 IP_INACL_ERROR_HIT, hits);
777 is_output ? IP_OUTACL_ERROR_CHAIN_HIT :
778 IP_INACL_ERROR_CHAIN_HIT, chain_hits);
804 return frame->n_vectors;
829 return frame->n_vectors;
835 .vector_size =
sizeof (
u32),
847 .name =
"ip4-outacl",
848 .vector_size =
sizeof (
u32),
882 return frame->n_vectors;
907 return frame->n_vectors;
913 .vector_size =
sizeof (
u32),
925 .name =
"ip6-outacl",
926 .vector_size =
sizeof (
u32),
938 #ifndef CLIB_MARCH_VARIANT u64 vnet_classify_hash_packet(vnet_classify_table_t *t, u8 *h)
vlib_node_registration_t ip4_inacl_node
(constructor) VLIB_REGISTER_NODE (ip4_inacl_node)
static u8 * format_ip_in_out_acl_trace(u8 *s, u32 is_output, va_list *args)
vl_api_wireguard_peer_flags_t flags
static vnet_classify_entry_t * vnet_classify_find_entry_inline(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
u32 * classify_table_index_by_sw_if_index[IN_OUT_ACL_N_TABLE_GROUPS][IN_OUT_ACL_N_TABLES]
static f64 vlib_time_now(vlib_main_t *vm)
#define VLIB_NODE_FN(node)
vlib_error_t * errors
Vector of errors for this node.
#define CLASSIFY_FLAG_USE_CURR_DATA
#define static_always_inline
static_always_inline void ip_in_out_acl_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t **b, u16 *next, u32 n_left, int is_ip4, int is_output, int do_trace)
#define VLIB_INIT_FUNCTION(x)
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define foreach_ip_outacl_error
vnet_config_main_t * vnet_config_main[IN_OUT_ACL_N_TABLE_GROUPS][IN_OUT_ACL_N_TABLES]
static void vnet_classify_prefetch_bucket(vnet_classify_table_t *t, u64 hash)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static u64 vnet_classify_hash_packet_inline(vnet_classify_table_t *t, u8 *h)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
vlib_node_registration_t ip6_input_node
(constructor) VLIB_REGISTER_NODE (ip6_input_node)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static char * ip_inacl_error_strings[]
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
u32 node_index
Node index.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static uword vnet_classify_get_offset(vnet_classify_table_t *t, vnet_classify_entry_t *v)
vlib_node_registration_t ip6_inacl_node
(constructor) VLIB_REGISTER_NODE (ip6_inacl_node)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
#define foreach_ip_inacl_error
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vlib_node_registration_t ip6_outacl_node
(constructor) VLIB_REGISTER_NODE (ip6_outacl_node)
vlib_main_t vlib_node_runtime_t * node
struct _vnet_classify_main vnet_classify_main_t
static u8 * format_ip_outacl_trace(u8 *s, va_list *args)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_node_registration_t ip4_outacl_node
(constructor) VLIB_REGISTER_NODE (ip4_outacl_node)
static char * ip_outacl_error_strings[]
static u8 * format_ip_inacl_trace(u8 *s, va_list *args)
struct _vlib_node_registration vlib_node_registration_t
vl_api_mac_event_action_t action
vnet_classify_main_t * vnet_classify_main
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
in_out_acl_main_t in_out_acl_main
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
static clib_error_t * ip_in_out_acl_init(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index