16 #include <netinet/in.h> 47 return format(s,
"%s sw_if_index %d (lsb16 %d) l3 %s%s %U -> %U" 48 " l4 proto %d l4_valid %d port %d -> %d tcp flags (%s) %02x rsvd %x",
77 "acl-plugin: sw_if_index %d, next index %d, action: %d, match: acl %d rule %d trace_bits %08x\n" 78 " pkt info %016llx %016llx %016llx %016llx %016llx %016llx",
90 #define foreach_acl_fa_error \ 91 _(ACL_DROP, "ACL deny packets") \ 92 _(ACL_PERMIT, "ACL permit packets") \ 93 _(ACL_NEW_SESSION, "new sessions added") \ 94 _(ACL_EXIST_SESSION, "existing session packets") \ 95 _(ACL_CHECK, "checked packets") \ 96 _(ACL_RESTART_SESSION_TIMER, "restart session timer") \ 97 _(ACL_TOO_MANY_SESSIONS, "too many sessions to add new") \ 102 #define _(sym,str) ACL_FA_ERROR_##sym, 109 #define _(sym,string) string, 125 int prefixlen,
int is_ip6)
134 if (memcmp (addr1, addr2, prefixlen / 8))
141 u8 b1 = *((
u8 *) addr1 + 1 + prefixlen / 8);
142 u8 b2 = *((
u8 *) addr2 + 1 + prefixlen / 8);
143 u8 mask0 = (0xff - ((1 << (8 - (prefixlen % 8))) - 1));
144 return (b1 & mask0) == b2;
154 uint32_t a1 = ntohl (addr1->ip4.as_u32);
155 uint32_t a2 = ntohl (addr2->ip4.as_u32);
156 uint32_t mask0 = 0xffffffff - ((1 << (32 - prefixlen)) - 1);
157 return (a1 & mask0) == a2;
164 return ((port >= port_first) && (port <= port_last));
169 int is_ip6,
u8 * r_action,
u32 * r_acl_match_p,
170 u32 * r_rule_match_p,
u32 * trace_bitmap)
179 *r_acl_match_p = acl_index;
181 *r_rule_match_p = -1;
185 a = am->
acls + acl_index;
186 for (i = 0; i < a->
count; i++)
197 #ifdef FA_NODE_VERBOSE_DEBUG 199 (
"ACL_FA_NODE_DBG acl %d rule %d pkt dst addr %U match rule addr %U/%d",
210 #ifdef FA_NODE_VERBOSE_DEBUG 212 (
"ACL_FA_NODE_DBG acl %d rule %d pkt src addr %U match rule addr %U/%d",
218 (
"ACL_FA_NODE_DBG acl %d rule %d trying to match pkt proto %d with rule %d",
230 *trace_bitmap |= 0x80000000;
233 *r_acl_match_p = acl_index;
243 #ifdef FA_NODE_VERBOSE_DEBUG 245 (
"ACL_FA_NODE_DBG acl %d rule %d pkt proto %d match rule %d",
254 #ifdef FA_NODE_VERBOSE_DEBUG 256 (
"ACL_FA_NODE_DBG acl %d rule %d pkt sport %d match rule [%d..%d]",
266 #ifdef FA_NODE_VERBOSE_DEBUG 268 (
"ACL_FA_NODE_DBG acl %d rule %d pkt dport %d match rule [%d..%d]",
278 #ifdef FA_NODE_VERBOSE_DEBUG 279 clib_warning (
"ACL_FA_NODE_DBG acl %d rule %d FULL-MATCH, action %d",
284 *r_acl_match_p = acl_index;
294 int is_ip6,
int is_input,
u32 * acl_match_p,
295 u32 * rule_match_p,
u32 * trace_bitmap)
312 for (i = 0; i <
vec_len (acl_vector); i++)
314 #ifdef FA_NODE_VERBOSE_DEBUG 315 clib_warning (
"ACL_FA_NODE_DBG: Trying to match ACL: %d",
319 (am, acl_vector[i], pkt_5tuple, is_ip6, &action,
320 acl_match_p, rule_match_p, trace_bitmap))
325 if (vec_len (acl_vector) > 0)
330 #ifdef FA_NODE_VERBOSE_DEBUG 331 clib_warning (
"ACL_FA_NODE_DBG: No ACL on sw_if_index %d", sw_if_index);
339 int is_ip6,
int is_input,
u32 * acl_match_p,
340 u32 * rule_match_p,
u32 * trace_bitmap)
345 is_input, acl_match_p, rule_match_p, trace_bitmap);
348 is_input, acl_match_p, rule_match_p, trace_bitmap);
361 int is_input,
int is_l2_path,
fa_5tuple_t * p5tuple_pkt)
369 static u8 icmp_protos[] = { IP_PROTOCOL_ICMP, IP_PROTOCOL_ICMP6 };
380 l3_offset =
vnet_buffer(b0)->ip.save_rewrite_length;
385 p5tuple_pkt->
kv.
key[4] = 0;
393 src_address) + l3_offset),
394 sizeof (p5tuple_pkt->
addr));
398 protocol) + l3_offset);
400 #ifdef FA_NODE_VERBOSE_DEBUG 401 clib_warning (
"ACL_FA_NODE_DBG: proto: %d, l4_offset: %d", proto,
416 frag_offset = ntohs(frag_offset) >> 3;
433 l4_offset += 8 * (1 + (
u16) nwords);
435 #ifdef FA_NODE_VERBOSE_DEBUG 436 clib_warning (
"ACL_FA_NODE_DBG: new proto: %d, new offset: %d",
446 p5tuple_pkt->
kv.
key[0] = 0;
447 p5tuple_pkt->
kv.
key[1] = 0;
448 p5tuple_pkt->
kv.
key[2] = 0;
449 p5tuple_pkt->
kv.
key[3] = 0;
453 src_address) + l3_offset),
454 sizeof (p5tuple_pkt->
addr[0].ip4));
458 dst_address) + l3_offset),
459 sizeof (p5tuple_pkt->
addr[1].ip4));
463 protocol) + l3_offset);
465 u16 flags_and_fragment_offset;
469 flags_and_fragment_offset)) + l3_offset,
470 sizeof(flags_and_fragment_offset));
471 flags_and_fragment_offset = ntohs (flags_and_fragment_offset);
486 if (icmp_protos[is_ip6] == proto)
491 l4_offset + offsetof (icmp46_header_t,
496 l4_offset + offsetof (icmp46_header_t,
499 else if ((IPPROTO_TCP == proto) || (IPPROTO_UDP == proto))
506 p5tuple_pkt->
l4.
port[0] = ntohs (ports[0]);
507 p5tuple_pkt->
l4.
port[1] = ntohs (ports[1]);
538 int src_index = is_input ? 0 : 1;
539 int dst_index = is_input ? 1 : 0;
540 p5tuple_sess->
addr[src_index] = p5tuple_pkt->
addr[0];
541 p5tuple_sess->
addr[dst_index] = p5tuple_pkt->
addr[1];
543 p5tuple_sess->
l4.
port[src_index] = p5tuple_pkt->
l4.
port[0];
544 p5tuple_sess->
l4.
port[dst_index] = p5tuple_pkt->
l4.
port[1];
602 for(timeout_type = 0; timeout_type <
ACL_N_TIMEOUTS; timeout_type++) {
652 "ACL plugin FA session bihash",
708 #ifdef FA_NODE_VERBOSE_DEBUG 709 clib_warning(
"thread id in key %d != curr thread index, not deleting");
792 return (curr_sess_count < am->fa_conn_table_max_entries);
832 int total_expired = 0;
856 u64 sess_timeout_time =
860 #ifdef FA_NODE_VERBOSE_DEBUG 861 clib_warning (
"ACL_FA_NODE_CLEAN: Restarting timer for session %d",
862 (
int) session_index);
872 #ifdef FA_NODE_VERBOSE_DEBUG 874 (
int) session_index);
894 return (total_expired);
936 memcpy (sess, pkv,
sizeof (pkv->
key));
972 int is_input,
int is_l2_path,
u32 * l2_feat_next_node_index,
975 u32 n_left_from, *from, *to_next;
977 u32 pkts_acl_checked = 0;
978 u32 pkts_new_session = 0;
979 u32 pkts_exist_session = 0;
980 u32 pkts_acl_permit = 0;
981 u32 pkts_restart_session_timer = 0;
982 u32 trace_bitmap = 0;
996 while (n_left_from > 0)
1002 while (n_left_from > 0 && n_left_to_next > 0)
1009 int acl_check_needed = 1;
1010 u32 match_acl_in_index = ~0;
1011 u32 match_rule_index = ~0;
1020 n_left_to_next -= 1;
1042 #ifdef FA_NODE_VERBOSE_DEBUG 1044 (
"ACL_FA_NODE_DBG: session 5-tuple %016llx %016llx %016llx %016llx %016llx : %016llx",
1048 (
"ACL_FA_NODE_DBG: packet 5-tuple %016llx %016llx %016llx %016llx %016llx : %016llx",
1058 (am, sw_if_index0, &kv_sess, &value_sess))
1060 trace_bitmap |= 0x80000000;
1061 error0 = ACL_FA_ERROR_ACL_EXIST_SESSION;
1068 int old_timeout_type =
1075 int new_timeout_type =
1077 acl_check_needed = 0;
1078 pkts_exist_session += 1;
1083 pkts_restart_session_timer++;
1085 0x00010000 + ((0xff & old_timeout_type) << 8) +
1086 (0xff & new_timeout_type);
1098 clib_warning(
"BUG: session LSB16(sw_if_index) and 5-tuple collision!");
1099 acl_check_needed = 0;
1105 if (acl_check_needed)
1109 is_ip6, is_input, &match_acl_in_index,
1110 &match_rule_index, &trace_bitmap);
1113 pkts_acl_permit += 1;
1125 pkts_new_session += 1;
1130 error0 = ACL_FA_ERROR_ACL_TOO_MANY_SESSIONS;
1167 pkts_acl_checked += 1;
1171 to_next, n_left_to_next, bi0,
1179 ACL_FA_ERROR_ACL_CHECK, pkts_acl_checked);
1181 ACL_FA_ERROR_ACL_PERMIT, pkts_acl_permit);
1183 ACL_FA_ERROR_ACL_NEW_SESSION,
1186 ACL_FA_ERROR_ACL_EXIST_SESSION,
1187 pkts_exist_session);
1189 ACL_FA_ERROR_ACL_RESTART_SESSION_TIMER,
1190 pkts_restart_session_timer);
1283 #define foreach_acl_fa_cleaner_error \ 1284 _(UNKNOWN_EVENT, "unknown event received") \ 1289 #define _(sym,str) ACL_FA_CLEANER_ERROR_##sym, 1296 #define _(sym,string) string, 1319 #ifdef FA_NODE_VERBOSE_DEBUG 1320 clib_warning(
"\nacl_fa_worker_conn_cleaner: thread index %d now %lu\n\n", thread_index, now);
1339 #ifdef FA_NODE_VERBOSE_DEBUG 1340 clib_warning(
"WORKER-CLEAR: someone tried to call clear, but one of the bitmaps are empty");
1344 #ifdef FA_NODE_VERBOSE_DEBUG 1345 clib_warning(
"WORKER-CLEAR: (before and) swiping sw-if-index bitmap: %U, my serviced bitmap %U",
1355 #ifdef FA_NODE_VERBOSE_DEBUG 1360 #ifdef FA_NODE_VERBOSE_DEBUG 1361 clib_warning(
"WORKER-CLEAR: swiping sw-if-index bitmap: %U, my serviced bitmap %U",
1373 if (0 == num_expired) {
1377 #ifdef FA_NODE_VERBOSE_DEBUG 1381 #ifdef FA_NODE_VERBOSE_DEBUG 1382 clib_warning(
"WORKER-CLEAR: more work to do, raising interrupt");
1392 }
else if (num_expired <= am->fa_min_deleted_sessions_per_interval) {
1425 for (i = n_threads > 1 ? 1 : 0; i < n_threads; i++) {
1440 u64 max_timer_wait_interval = cpu_cps / 2;
1441 uword event_type, *event_data = 0;
1451 int has_pending_conns = 0;
1471 #ifdef FA_NODE_VERBOSE_DEBUG 1472 clib_warning(
"Head expiry: %lu, now: %lu, next_expire: %lu (worker: %d, tt: %d)", head_expiry, now, next_expire, ti, tt);
1474 next_expire = head_expiry;
1477 has_pending_conns = 1;
1485 am->fa_cleaner_cnt_wait_without_timeout++;
1491 f64 timeout = ((
i64) next_expire - (
i64) now) / cpu_cps;
1499 am->fa_cleaner_cnt_wait_with_timeout++;
1515 uword *clear_sw_if_index_bitmap = 0;
1516 uword *sw_if_index0;
1518 #ifdef FA_NODE_VERBOSE_DEBUG 1519 clib_warning(
"ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX received");
1523 am->fa_cleaner_cnt_delete_by_sw_index++;
1524 #ifdef FA_NODE_VERBOSE_DEBUG 1526 (
"ACL_FA_NODE_CLEAN: ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX: %d",
1529 if (*sw_if_index0 == ~0)
1537 clear_sw_if_index_bitmap =
clib_bitmap_set(clear_sw_if_index_bitmap, *sw_if_index0, 1);
1541 #ifdef FA_NODE_VERBOSE_DEBUG 1548 #ifdef FA_NODE_VERBOSE_DEBUG 1557 clib_warning(
"ERROR-BUG! Could not initiate cleaning on worker because another cleanup in progress");
1575 #ifdef FA_NODE_VERBOSE_DEBUG 1582 #ifdef FA_NODE_VERBOSE_DEBUG 1591 #ifdef FA_NODE_VERBOSE_DEBUG 1598 #ifdef FA_NODE_VERBOSE_DEBUG 1599 clib_warning (
"ACL plugin connection cleaner: unknown event %u",
1605 ACL_FA_CLEANER_ERROR_UNKNOWN_EVENT, 1);
1606 am->fa_cleaner_cnt_unknown_event++;
1613 _vec_len (event_data) = 0;
1619 int need_more_wait = 0;
1620 int max_wait_cycles = 100;
1628 if (need_more_wait) {
1631 }
while (need_more_wait && (--max_wait_cycles > 0));
1633 int interrupts_needed = 0;
1634 int interrupts_unwanted = 0;
1638 interrupts_needed++;
1642 interrupts_unwanted++;
1646 if (interrupts_needed) {
1651 }
else if (interrupts_unwanted) {
1656 am->fa_cleaner_cnt_event_cycles++;
1668 if (enable_disable) {
1684 sw_if_index, enable_disable, 0, 0);
1686 sw_if_index, enable_disable, 0, 0);
1697 sw_if_index, enable_disable, 0, 0);
1699 sw_if_index, enable_disable, 0, 0);
1708 #ifdef FA_NODE_VERBOSE_DEBUG 1709 clib_warning(
"ENABLE-DISABLE: clean the connections on interface %d", sw_if_index);
1727 vlib_cli_output(vm,
"\nSession lookup hash table is not allocated.\n\n");
1736 .name =
"acl-plugin-fa-worker-cleaner-process",
1738 .state = VLIB_NODE_STATE_INTERRUPT,
1744 .name =
"acl-plugin-fa-cleaner-process",
1755 .name =
"acl-plugin-in-ip6-l2",
1756 .vector_size =
sizeof (
u32),
1771 .name =
"acl-plugin-in-ip4-l2",
1772 .vector_size =
sizeof (
u32),
1787 .name =
"acl-plugin-out-ip6-l2",
1788 .vector_size =
sizeof (
u32),
1803 .name =
"acl-plugin-out-ip4-l2",
1804 .vector_size =
sizeof (
u32),
1820 .name =
"acl-plugin-in-ip6-fa",
1821 .vector_size =
sizeof (
u32),
1835 .arc_name =
"ip6-unicast",
1836 .node_name =
"acl-plugin-in-ip6-fa",
1843 .name =
"acl-plugin-in-ip4-fa",
1844 .vector_size =
sizeof (
u32),
1858 .arc_name =
"ip4-unicast",
1859 .node_name =
"acl-plugin-in-ip4-fa",
1867 .name =
"acl-plugin-out-ip6-fa",
1868 .vector_size =
sizeof (
u32),
1882 .arc_name =
"ip6-output",
1883 .node_name =
"acl-plugin-out-ip6-fa",
1890 .name =
"acl-plugin-out-ip4-fa",
1891 .vector_size =
sizeof (
u32),
1906 .arc_name =
"ip4-output",
1907 .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
union fa_session_t::@311 tcp_flags_seen
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)
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
u8 * format_acl_plugin_5tuple(u8 *s, va_list *args)
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 u8 * format_fa_5tuple(u8 *s, va_list *args)
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