16 #include <netinet/in.h> 52 "acl-plugin: sw_if_index %d, next index %d, action: %d, match: acl %d rule %d trace_bits %08x\n" 53 " pkt info %016llx %016llx %016llx %016llx %016llx %016llx",
62 #define foreach_acl_fa_error \ 63 _(ACL_DROP, "ACL deny packets") \ 64 _(ACL_PERMIT, "ACL permit packets") \ 65 _(ACL_NEW_SESSION, "new sessions added") \ 66 _(ACL_EXIST_SESSION, "existing session packets") \ 67 _(ACL_CHECK, "checked packets") \ 68 _(ACL_RESTART_SESSION_TIMER, "restart session timer") \ 69 _(ACL_TOO_MANY_SESSIONS, "too many sessions to add new") \ 74 #define _(sym,str) ACL_FA_ERROR_##sym, 81 #define _(sym,string) string, 97 int prefixlen,
int is_ip6)
106 if (memcmp (addr1, addr2, prefixlen / 8))
113 u8 b1 = *((
u8 *) addr1 + 1 + prefixlen / 8);
114 u8 b2 = *((
u8 *) addr2 + 1 + prefixlen / 8);
115 u8 mask0 = (0xff - ((1 << (8 - (prefixlen % 8))) - 1));
116 return (b1 & mask0) == b2;
126 uint32_t a1 = ntohl (addr1->ip4.as_u32);
127 uint32_t a2 = ntohl (addr2->ip4.as_u32);
128 uint32_t mask0 = 0xffffffff - ((1 << (32 - prefixlen)) - 1);
129 return (a1 & mask0) == a2;
136 return ((port >= port_first) && (port <= port_last));
141 int is_ip6,
u8 * r_action,
u32 * r_acl_match_p,
142 u32 * r_rule_match_p,
u32 * trace_bitmap)
151 *r_acl_match_p = acl_index;
153 *r_rule_match_p = -1;
157 a = am->
acls + acl_index;
158 for (i = 0; i < a->
count; i++)
169 #ifdef FA_NODE_VERBOSE_DEBUG 171 (
"ACL_FA_NODE_DBG acl %d rule %d pkt dst addr %U match rule addr %U/%d",
181 #ifdef FA_NODE_VERBOSE_DEBUG 183 (
"ACL_FA_NODE_DBG acl %d rule %d pkt src addr %U match rule addr %U/%d",
188 (
"ACL_FA_NODE_DBG acl %d rule %d trying to match pkt proto %d with rule %d",
200 *trace_bitmap |= 0x80000000;
203 *r_acl_match_p = acl_index;
213 #ifdef FA_NODE_VERBOSE_DEBUG 215 (
"ACL_FA_NODE_DBG acl %d rule %d pkt proto %d match rule %d",
224 #ifdef FA_NODE_VERBOSE_DEBUG 226 (
"ACL_FA_NODE_DBG acl %d rule %d pkt sport %d match rule [%d..%d]",
236 #ifdef FA_NODE_VERBOSE_DEBUG 238 (
"ACL_FA_NODE_DBG acl %d rule %d pkt dport %d match rule [%d..%d]",
248 #ifdef FA_NODE_VERBOSE_DEBUG 249 clib_warning (
"ACL_FA_NODE_DBG acl %d rule %d FULL-MATCH, action %d",
254 *r_acl_match_p = acl_index;
264 int is_ip6,
int is_input,
u32 * acl_match_p,
265 u32 * rule_match_p,
u32 * trace_bitmap)
282 for (i = 0; i <
vec_len (acl_vector); i++)
284 #ifdef FA_NODE_VERBOSE_DEBUG 285 clib_warning (
"ACL_FA_NODE_DBG: Trying to match ACL: %d",
289 (am, acl_vector[i], pkt_5tuple, is_ip6, &action,
290 acl_match_p, rule_match_p, trace_bitmap))
295 if (vec_len (acl_vector) > 0)
300 #ifdef FA_NODE_VERBOSE_DEBUG 301 clib_warning (
"ACL_FA_NODE_DBG: No ACL on sw_if_index %d", sw_if_index);
309 int is_ip6,
int is_input,
u32 * acl_match_p,
310 u32 * rule_match_p,
u32 * trace_bitmap)
315 is_input, acl_match_p, rule_match_p, trace_bitmap);
318 is_input, acl_match_p, rule_match_p, trace_bitmap);
331 int is_input,
int is_l2_path,
fa_5tuple_t * p5tuple_pkt)
338 static u8 icmp_protos[] = { IP_PROTOCOL_ICMP, IP_PROTOCOL_ICMP6 };
340 if (is_input && !(is_l2_path))
347 p5tuple_pkt->
kv.
key[4] = 0;
355 src_address) + l3_offset),
356 sizeof (p5tuple_pkt->
addr));
360 protocol) + l3_offset);
362 #ifdef FA_NODE_VERBOSE_DEBUG 363 clib_warning (
"ACL_FA_NODE_DBG: proto: %d, l4_offset: %d", proto,
378 frag_offset = ntohs(frag_offset) >> 3;
395 l4_offset += 8 * (1 + (
u16) nwords);
397 #ifdef FA_NODE_VERBOSE_DEBUG 398 clib_warning (
"ACL_FA_NODE_DBG: new proto: %d, new offset: %d",
408 p5tuple_pkt->
kv.
key[0] = 0;
409 p5tuple_pkt->
kv.
key[1] = 0;
410 p5tuple_pkt->
kv.
key[2] = 0;
411 p5tuple_pkt->
kv.
key[3] = 0;
415 src_address) + l3_offset),
416 sizeof (p5tuple_pkt->
addr[0].ip4));
420 dst_address) + l3_offset),
421 sizeof (p5tuple_pkt->
addr[1].ip4));
425 protocol) + l3_offset);
427 u16 flags_and_fragment_offset;
431 flags_and_fragment_offset)) + l3_offset,
432 sizeof(flags_and_fragment_offset));
433 flags_and_fragment_offset = ntohs (flags_and_fragment_offset);
448 if (icmp_protos[is_ip6] == proto)
453 l4_offset + offsetof (icmp46_header_t,
458 l4_offset + offsetof (icmp46_header_t,
461 else if ((IPPROTO_TCP == proto) || (IPPROTO_UDP == proto))
468 p5tuple_pkt->
l4.
port[0] = ntohs (ports[0]);
469 p5tuple_pkt->
l4.
port[1] = ntohs (ports[1]);
500 int src_index = is_input ? 0 : 1;
501 int dst_index = is_input ? 1 : 0;
502 p5tuple_sess->
addr[src_index] = p5tuple_pkt->
addr[0];
503 p5tuple_sess->
addr[dst_index] = p5tuple_pkt->
addr[1];
505 p5tuple_sess->
l4.
port[src_index] = p5tuple_pkt->
l4.
port[0];
506 p5tuple_sess->
l4.
port[dst_index] = p5tuple_pkt->
l4.
port[1];
564 for(timeout_type = 0; timeout_type <
ACL_N_TIMEOUTS; timeout_type++) {
614 "ACL plugin FA session bihash",
670 #ifdef FA_NODE_VERBOSE_DEBUG 671 clib_warning(
"thread id in key %d != curr thread index, not deleting");
754 return (curr_sess_count < am->fa_conn_table_max_entries);
794 int total_expired = 0;
818 u64 sess_timeout_time =
822 #ifdef FA_NODE_VERBOSE_DEBUG 823 clib_warning (
"ACL_FA_NODE_CLEAN: Restarting timer for session %d",
824 (
int) session_index);
834 #ifdef FA_NODE_VERBOSE_DEBUG 836 (
int) session_index);
856 return (total_expired);
898 memcpy (sess, pkv,
sizeof (pkv->
key));
934 int is_input,
int is_l2_path,
u32 * l2_feat_next_node_index,
937 u32 n_left_from, *from, *to_next;
939 u32 pkts_acl_checked = 0;
940 u32 pkts_new_session = 0;
941 u32 pkts_exist_session = 0;
942 u32 pkts_acl_permit = 0;
943 u32 pkts_restart_session_timer = 0;
944 u32 trace_bitmap = 0;
958 while (n_left_from > 0)
964 while (n_left_from > 0 && n_left_to_next > 0)
971 int acl_check_needed = 1;
972 u32 match_acl_in_index = ~0;
973 u32 match_rule_index = ~0;
1004 #ifdef FA_NODE_VERBOSE_DEBUG 1006 (
"ACL_FA_NODE_DBG: session 5-tuple %016llx %016llx %016llx %016llx %016llx : %016llx",
1010 (
"ACL_FA_NODE_DBG: packet 5-tuple %016llx %016llx %016llx %016llx %016llx : %016llx",
1020 (am, sw_if_index0, &kv_sess, &value_sess))
1022 trace_bitmap |= 0x80000000;
1023 error0 = ACL_FA_ERROR_ACL_EXIST_SESSION;
1030 int old_timeout_type =
1037 int new_timeout_type =
1039 acl_check_needed = 0;
1040 pkts_exist_session += 1;
1045 pkts_restart_session_timer++;
1047 0x00010000 + ((0xff & old_timeout_type) << 8) +
1048 (0xff & new_timeout_type);
1060 clib_warning(
"BUG: session LSB16(sw_if_index) and 5-tuple collision!");
1061 acl_check_needed = 0;
1067 if (acl_check_needed)
1071 is_ip6, is_input, &match_acl_in_index,
1072 &match_rule_index, &trace_bitmap);
1075 pkts_acl_permit += 1;
1087 pkts_new_session += 1;
1092 error0 = ACL_FA_ERROR_ACL_TOO_MANY_SESSIONS;
1129 pkts_acl_checked += 1;
1133 to_next, n_left_to_next, bi0,
1141 ACL_FA_ERROR_ACL_CHECK, pkts_acl_checked);
1143 ACL_FA_ERROR_ACL_PERMIT, pkts_acl_permit);
1145 ACL_FA_ERROR_ACL_NEW_SESSION,
1148 ACL_FA_ERROR_ACL_EXIST_SESSION,
1149 pkts_exist_session);
1151 ACL_FA_ERROR_ACL_RESTART_SESSION_TIMER,
1152 pkts_restart_session_timer);
1245 #define foreach_acl_fa_cleaner_error \ 1246 _(UNKNOWN_EVENT, "unknown event received") \ 1251 #define _(sym,str) ACL_FA_CLEANER_ERROR_##sym, 1258 #define _(sym,string) string, 1281 #ifdef FA_NODE_VERBOSE_DEBUG 1282 clib_warning(
"\nacl_fa_worker_conn_cleaner: thread index %d now %lu\n\n", thread_index, now);
1301 #ifdef FA_NODE_VERBOSE_DEBUG 1302 clib_warning(
"WORKER-CLEAR: someone tried to call clear, but one of the bitmaps are empty");
1306 #ifdef FA_NODE_VERBOSE_DEBUG 1307 clib_warning(
"WORKER-CLEAR: (before and) swiping sw-if-index bitmap: %U, my serviced bitmap %U",
1317 #ifdef FA_NODE_VERBOSE_DEBUG 1322 #ifdef FA_NODE_VERBOSE_DEBUG 1323 clib_warning(
"WORKER-CLEAR: swiping sw-if-index bitmap: %U, my serviced bitmap %U",
1335 if (0 == num_expired) {
1339 #ifdef FA_NODE_VERBOSE_DEBUG 1343 #ifdef FA_NODE_VERBOSE_DEBUG 1344 clib_warning(
"WORKER-CLEAR: more work to do, raising interrupt");
1354 }
else if (num_expired <= am->fa_min_deleted_sessions_per_interval) {
1387 for (i = n_threads > 1 ? 1 : 0; i < n_threads; i++) {
1402 u64 max_timer_wait_interval = cpu_cps / 2;
1403 uword event_type, *event_data = 0;
1413 int has_pending_conns = 0;
1433 #ifdef FA_NODE_VERBOSE_DEBUG 1434 clib_warning(
"Head expiry: %lu, now: %lu, next_expire: %lu (worker: %d, tt: %d)", head_expiry, now, next_expire, ti, tt);
1436 next_expire = head_expiry;
1439 has_pending_conns = 1;
1447 am->fa_cleaner_cnt_wait_without_timeout++;
1453 f64 timeout = ((
i64) next_expire - (
i64) now) / cpu_cps;
1461 am->fa_cleaner_cnt_wait_with_timeout++;
1477 uword *clear_sw_if_index_bitmap = 0;
1478 uword *sw_if_index0;
1480 #ifdef FA_NODE_VERBOSE_DEBUG 1481 clib_warning(
"ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX received");
1485 am->fa_cleaner_cnt_delete_by_sw_index++;
1486 #ifdef FA_NODE_VERBOSE_DEBUG 1488 (
"ACL_FA_NODE_CLEAN: ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX: %d",
1491 if (*sw_if_index0 == ~0)
1499 clear_sw_if_index_bitmap =
clib_bitmap_set(clear_sw_if_index_bitmap, *sw_if_index0, 1);
1503 #ifdef FA_NODE_VERBOSE_DEBUG 1510 #ifdef FA_NODE_VERBOSE_DEBUG 1519 clib_warning(
"ERROR-BUG! Could not initiate cleaning on worker because another cleanup in progress");
1537 #ifdef FA_NODE_VERBOSE_DEBUG 1544 #ifdef FA_NODE_VERBOSE_DEBUG 1553 #ifdef FA_NODE_VERBOSE_DEBUG 1560 #ifdef FA_NODE_VERBOSE_DEBUG 1561 clib_warning (
"ACL plugin connection cleaner: unknown event %u",
1567 ACL_FA_CLEANER_ERROR_UNKNOWN_EVENT, 1);
1568 am->fa_cleaner_cnt_unknown_event++;
1575 _vec_len (event_data) = 0;
1581 int need_more_wait = 0;
1582 int max_wait_cycles = 100;
1590 if (need_more_wait) {
1593 }
while (need_more_wait && (--max_wait_cycles > 0));
1595 int interrupts_needed = 0;
1596 int interrupts_unwanted = 0;
1600 interrupts_needed++;
1604 interrupts_unwanted++;
1608 if (interrupts_needed) {
1613 }
else if (interrupts_unwanted) {
1618 am->fa_cleaner_cnt_event_cycles++;
1630 if (enable_disable) {
1646 sw_if_index, enable_disable, 0, 0);
1648 sw_if_index, enable_disable, 0, 0);
1659 sw_if_index, enable_disable, 0, 0);
1661 sw_if_index, enable_disable, 0, 0);
1670 #ifdef FA_NODE_VERBOSE_DEBUG 1671 clib_warning(
"ENABLE-DISABLE: clean the connections on interface %d", sw_if_index);
1689 vlib_cli_output(vm,
"\nSession lookup hash table is not allocated.\n\n");
1698 .name =
"acl-plugin-fa-worker-cleaner-process",
1700 .state = VLIB_NODE_STATE_INTERRUPT,
1706 .name =
"acl-plugin-fa-cleaner-process",
1717 .name =
"acl-plugin-in-ip6-l2",
1718 .vector_size =
sizeof (
u32),
1733 .name =
"acl-plugin-in-ip4-l2",
1734 .vector_size =
sizeof (
u32),
1749 .name =
"acl-plugin-out-ip6-l2",
1750 .vector_size =
sizeof (
u32),
1765 .name =
"acl-plugin-out-ip4-l2",
1766 .vector_size =
sizeof (
u32),
1782 .name =
"acl-plugin-in-ip6-fa",
1783 .vector_size =
sizeof (
u32),
1797 .arc_name =
"ip6-unicast",
1798 .node_name =
"acl-plugin-in-ip6-fa",
1805 .name =
"acl-plugin-in-ip4-fa",
1806 .vector_size =
sizeof (
u32),
1820 .arc_name =
"ip4-unicast",
1821 .node_name =
"acl-plugin-in-ip4-fa",
1829 .name =
"acl-plugin-out-ip6-fa",
1830 .vector_size =
sizeof (
u32),
1844 .arc_name =
"ip6-output",
1845 .node_name =
"acl-plugin-out-ip6-fa",
1852 .name =
"acl-plugin-out-ip4-fa",
1853 .vector_size =
sizeof (
u32),
1868 .arc_name =
"ip4-output",
1869 .node_name =
"acl-plugin-out-ip4-fa",
static uword acl_in_ip4_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int acl_fa_restart_timer_for_session(acl_main_t *am, u64 now, fa_full_session_id_t sess_id)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static int acl_fa_ifc_has_in_acl(acl_main_t *am, int sw_if_index0)
u32 fa_cleaner_node_index
static void acl_fa_conn_list_add_session(acl_main_t *am, fa_full_session_id_t sess_id, u64 now)
u32 session_timeout_sec[ACL_N_TIMEOUTS]
static u8 * format_bitmap_hex(u8 *s, va_list *args)
Format a bitmap as a string of hex bytes.
u32 fa_acl_in_ip4_l2_node_feat_next_node_index[32]
static int acl_fa_can_add_session(acl_main_t *am, int is_input, u32 sw_if_index)
static int is_valid_session_ptr(acl_main_t *am, u16 thread_index, fa_session_t *sess)
static char * acl_fa_cleaner_error_strings[]
sll srl srl sll sra u16x4 i
void show_fa_sessions_hash(vlib_main_t *vm, u32 verbose)
uword * fa_out_acl_on_sw_if_index
uword * pending_clear_sw_if_index_bitmap
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
u64 fa_current_cleaner_timer_wait_interval
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
u32 ** input_acl_vec_by_sw_if_index
vnet_interface_main_t interface_main
uword * fa_in_acl_on_sw_if_index
static uword acl_fa_worker_conn_cleaner_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
int l4_match_nonfirst_fragment
vlib_node_registration_t acl_out_fa_ip6_node
(constructor) VLIB_REGISTER_NODE (acl_out_fa_ip6_node)
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
static void send_interrupts_to_workers(vlib_main_t *vm, acl_main_t *am)
static int fa_acl_match_port(u16 port, u16 port_first, u16 port_last, int is_ip6)
static void acl_fa_verify_init_sessions(acl_main_t *am)
vlib_node_registration_t acl_out_l2_ip4_node
(constructor) VLIB_REGISTER_NODE (acl_out_l2_ip4_node)
#define ethernet_buffer_header_size(b)
Determine the size of the Ethernet headers of the current frame in the buffer.
#define TCP_FLAGS_RSTFINACKSYN
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_cpu_time_now(void)
struct _vlib_node_registration vlib_node_registration_t
static int acl_fa_find_session(acl_main_t *am, u32 sw_if_index0, fa_5tuple_t *p5tuple, clib_bihash_kv_40_8_t *pvalue_sess)
static uword acl_out_ip4_fa_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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. ...
fa_session_t * fa_sessions_pool
#define foreach_acl_fa_error
static void acl_fa_try_recycle_session(acl_main_t *am, int is_input, u16 thread_index, u32 sw_if_index)
vlib_error_t * errors
Vector of errors for this node.
int single_acl_match_5tuple(acl_main_t *am, u32 acl_index, fa_5tuple_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
struct _tcp_header tcp_header_t
vlib_main_t ** vlib_mains
static u8 * format_acl_fa_trace(u8 *s, va_list *args)
#define pool_len(p)
Number of elements in pool vector.
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
static uword acl_fa_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_ip6, int is_input, int is_l2_path, u32 *l2_feat_next_node_index, vlib_node_registration_t *acl_fa_node)
#define clib_bitmap_zero(v)
Clear a bitmap.
#define clib_bitmap_dup(v)
Duplicate a bitmap.
u32 fa_acl_out_ip4_l2_node_feat_next_node_index[32]
f64 fa_cleaner_wait_time_increment
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
static int acl_fa_check_idle_sessions(acl_main_t *am, u16 thread_index, u64 now)
uword fa_conn_table_hash_memory_size
u16 dst_port_or_code_last
#define clib_smp_atomic_add(addr, increment)
vlib_node_registration_t acl_in_fa_ip6_node
(constructor) VLIB_REGISTER_NODE (acl_in_fa_ip6_node)
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
#define pool_alloc_aligned(P, N, A)
Allocate N more free elements to pool (general version).
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
u64 fa_conn_table_max_entries
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
u64 cnt_session_timer_restarted
#define foreach_acl_fa_cleaner_error
static uword acl_in_ip6_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int acl_fa_conn_list_delete_session(acl_main_t *am, fa_full_session_id_t sess_id)
static fa_session_t * get_session_ptr(acl_main_t *am, u16 thread_index, u32 session_index)
clib_bihash_40_8_t fa_sessions_hash
u32 fa_acl_out_ip6_l2_node_feat_next_node_index[32]
static fa_session_t * acl_fa_add_session(acl_main_t *am, int is_input, u32 sw_if_index, u64 now, fa_5tuple_t *p5tuple)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u16 current_length
Nbytes between current data and the end of this buffer.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
u16 dst_port_or_code_first
static void acl_fill_5tuple(acl_main_t *am, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_t *p5tuple_pkt)
static uword acl_out_ip6_fa_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
uword * fa_ipv6_known_eh_bitmap
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u64 fa_session_get_list_timeout(acl_main_t *am, fa_session_t *sess)
static uword acl_out_ip6_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int fa_session_get_timeout_type(acl_main_t *am, fa_session_t *sess)
union fa_session_t::@287 tcp_flags_seen
static int acl_fa_ifc_has_out_acl(acl_main_t *am, int sw_if_index0)
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
int interrupt_is_unwanted
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
u32 fa_total_enabled_count
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
u8 hash_multi_acl_match_5tuple(u32 sw_if_index, fa_5tuple_t *pkt_5tuple, int is_l2, int is_ip6, int is_input, u32 *acl_match_p, u32 *rule_match_p, u32 *trace_bitmap)
u64 * fa_session_adds_by_sw_if_index
vlib_error_t error
Error code for buffers to be enqueued to error handler.
u16 src_port_or_type_first
u64 * fa_session_dels_by_sw_if_index
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
static uword acl_in_ip6_fa_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int offset_within_packet(vlib_buffer_t *b0, int offset)
u64 fa_session_total_adds
static void * clib_mem_set_heap(void *heap)
static int acl_fa_conn_time_to_check(acl_main_t *am, acl_fa_per_worker_data_t *pw, u64 now, u16 thread_index, u32 session_index)
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
int use_hash_acl_matching
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static u8 multi_acl_match_5tuple(u32 sw_if_index, fa_5tuple_t *pkt_5tuple, int is_l2, int is_ip6, int is_input, u32 *acl_match_p, u32 *rule_match_p, u32 *trace_bitmap)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
void acl_fa_enable_disable(u32 sw_if_index, int is_input, int enable_disable)
static vlib_node_registration_t acl_fa_session_cleaner_process_node
(constructor) VLIB_REGISTER_NODE (acl_fa_session_cleaner_process_node)
VNET_FEATURE_INIT(acl_in_ip6_fa_feature, static)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define pool_put_index(p, i)
Free pool element with given index.
static uword acl_out_ip4_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u64 fa_session_get_timeout(acl_main_t *am, fa_session_t *sess)
static u64 acl_fa_get_list_head_expiry_time(acl_main_t *am, acl_fa_per_worker_data_t *pw, u64 now, u16 thread_index, int timeout_type)
int clib_bihash_search(clib_bihash *h, clib_bihash_kv *search_v, clib_bihash_kv *return_v)
Search a bi-hash table.
static int acl_fa_ifc_has_sessions(acl_main_t *am, int sw_if_index0)
u16 src_port_or_type_last
static u8 acl_fa_track_session(acl_main_t *am, int is_input, u32 sw_if_index, u64 now, fa_session_t *sess, fa_5tuple_t *pkt_5tuple)
static void * get_ptr_to_offset(vlib_buffer_t *b0, int offset)
static uword acl_in_ip4_fa_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword acl_fa_session_cleaner_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
#define clib_bitmap_free(v)
Free a bitmap.
#define VLIB_NODE_FLAG_TRACE
vlib_node_registration_t acl_in_l2_ip4_node
(constructor) VLIB_REGISTER_NODE (acl_in_l2_ip4_node)
uword * serviced_sw_if_index_bitmap
vlib_node_registration_t acl_in_l2_ip6_node
(constructor) VLIB_REGISTER_NODE (acl_in_l2_ip6_node)
#define VNET_FEATURES(...)
u32 fa_acl_in_ip6_l2_node_feat_next_node_index[32]
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
template key/value backing page structure
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
acl_fa_per_worker_data_t * per_worker_data
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
int fa_interrupt_generation
u64 cnt_already_deleted_sessions
static_always_inline uword os_get_thread_index(void)
u64 fa_max_deleted_sessions_per_interval
static void acl_make_5tuple_session_key(int is_input, fa_5tuple_t *p5tuple_pkt, fa_5tuple_t *p5tuple_sess)
struct clib_bihash_value offset
template key/value backing page structure
vlib_node_registration_t acl_out_l2_ip6_node
(constructor) VLIB_REGISTER_NODE (acl_out_l2_ip6_node)
static char * acl_fa_error_strings[]
#define VLIB_REGISTER_NODE(x,...)
vlib_node_registration_t acl_out_fa_ip4_node
(constructor) VLIB_REGISTER_NODE (acl_out_fa_ip4_node)
#define vec_foreach(var, vec)
Vector iterator.
u16 flags
Copy of main node flags.
#define CLIB_MEMORY_BARRIER()
static int fa_acl_match_addr(ip46_address_t *addr1, ip46_address_t *addr2, int prefixlen, int is_ip6)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static u64 fa_session_get_shortest_timeout(acl_main_t *am)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int fa_sessions_hash_is_initialized
static vlib_node_registration_t acl_fa_worker_session_cleaner_process_node
(constructor) VLIB_REGISTER_NODE (acl_fa_worker_session_cleaner_process_node)
static uword * clib_bitmap_and(uword *ai, uword *bi)
Logical operator across two bitmaps.
static u8 linear_multi_acl_match_5tuple(u32 sw_if_index, fa_5tuple_t *pkt_5tuple, int is_l2, int is_ip6, int is_input, u32 *acl_match_p, u32 *rule_match_p, u32 *trace_bitmap)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u32 ** output_acl_vec_by_sw_if_index
static void send_one_worker_interrupt(vlib_main_t *vm, acl_main_t *am, int thread_index)
vlib_node_registration_t acl_in_fa_ip4_node
(constructor) VLIB_REGISTER_NODE (acl_in_fa_ip4_node)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
u32 fa_conn_table_hash_num_buckets
u64 fa_session_total_dels
static void acl_fa_delete_session(acl_main_t *am, u32 sw_if_index, fa_full_session_id_t sess_id)
foreach_fa_cleaner_counter vlib_main_t * vlib_main