26 #define foreach_nat44_classify_error \ 27 _(NEXT_IN2OUT, "next in2out") \ 28 _(NEXT_OUT2IN, "next out2in") \ 29 _(FRAG_CACHED, "fragment cached") 33 #define _(sym,str) NAT44_CLASSIFY_ERROR_##sym, 40 #define _(sym,string) string, 68 s =
format (s,
"nat44-classify: fragment cached");
71 next = t->
next_in2out ?
"nat44-in2out" :
"nat44-out2in";
72 s =
format (s,
"nat44-classify: next %s", next);
83 u32 n_left_from, *from, *to_next;
87 u32 *fragments_to_drop = 0;
88 u32 next_in2out = 0, next_out2in = 0;
94 while (n_left_from > 0)
100 while (n_left_from > 0 && n_left_to_next > 0)
149 clib_net_to_host_u16 (
vnet_buffer (b0)->
ip.reass.l4_dst_port);
152 if (!clib_bihash_search_8_8
163 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
176 to_next, n_left_to_next,
189 NAT44_CLASSIFY_ERROR_NEXT_IN2OUT, next_in2out);
191 NAT44_CLASSIFY_ERROR_NEXT_OUT2IN, next_out2in);
200 u32 n_left_from, *from, *to_next;
204 u32 *fragments_to_drop = 0;
205 u32 next_in2out = 0, next_out2in = 0;
211 while (n_left_from > 0)
217 while (n_left_from > 0 && n_left_to_next > 0)
266 clib_net_to_host_u16 (
vnet_buffer (b0)->
ip.reass.l4_dst_port);
269 if (!clib_bihash_search_8_8
280 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
293 to_next, n_left_to_next,
305 NAT44_CLASSIFY_ERROR_NEXT_IN2OUT, next_in2out);
307 NAT44_CLASSIFY_ERROR_NEXT_OUT2IN, next_out2in);
316 u32 n_left_from, *from, *to_next;
322 u32 *fragments_to_drop = 0;
323 u32 next_in2out = 0, next_out2in = 0;
329 while (n_left_from > 0)
335 while (n_left_from > 0 && n_left_to_next > 0)
340 u32 sw_if_index0, rx_fib_index0;
362 if (ip0->
protocol != IP_PROTOCOL_ICMP)
375 if (!clib_bihash_search_16_8
409 clib_net_to_host_u16 (
vnet_buffer (b0)->
ip.reass.l4_dst_port);
412 if (!clib_bihash_search_8_8
423 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
436 to_next, n_left_to_next,
449 NAT44_CLASSIFY_ERROR_NEXT_IN2OUT, next_in2out);
451 NAT44_CLASSIFY_ERROR_NEXT_OUT2IN, next_out2in);
464 .name =
"nat44-classify",
465 .vector_size =
sizeof (
u32),
488 .name =
"nat44-ed-classify",
489 .vector_size =
sizeof (
u32),
490 .sibling_of =
"nat-default",
505 .name =
"nat44-det-classify",
506 .vector_size =
sizeof (
u32),
527 .name =
"nat44-handoff-classify",
528 .vector_size =
sizeof (
u32),
529 .sibling_of =
"nat-default",
ip4_address_t external_addr
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
vlib_node_registration_t nat44_ed_classify_node
(constructor) VLIB_REGISTER_NODE (nat44_ed_classify_node)
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static u8 * format_nat44_classify_trace(u8 *s, va_list *args)
#define VLIB_NODE_FN(node)
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
vl_api_fib_path_type_t type
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
snat_static_mapping_t * static_mappings
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_bihash_8_8_t static_mapping_by_external
vlib_node_registration_t nat44_handoff_classify_node
(constructor) VLIB_REGISTER_NODE (nat44_handoff_classify_node)
u32 node_index
Node index.
#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.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static uword nat44_classify_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
8 octet key, 8 octet key value pair
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.
vlib_node_registration_t nat44_classify_node
(constructor) VLIB_REGISTER_NODE (nat44_classify_node)
vlib_main_t vlib_node_runtime_t * node
static char * nat44_classify_error_strings[]
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
VLIB buffer representation.
snat_main_per_thread_data_t * per_thread_data
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
snat_address_t * addresses
vlib_node_registration_t nat44_det_classify_node
(constructor) VLIB_REGISTER_NODE (nat44_det_classify_node)
#define vec_foreach(var, vec)
Vector iterator.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
static void nat_send_all_to_node(vlib_main_t *vm, u32 *bi_vector, vlib_node_runtime_t *node, vlib_error_t *error, u32 next)
clib_bihash_16_8_t in2out_ed
#define VLIB_NODE_FLAG_TRACE
#define foreach_nat44_classify_error
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static uword nat44_handoff_classify_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void make_ed_kv(ip4_address_t *l_addr, ip4_address_t *r_addr, u8 proto, u32 fib_index, u16 l_port, u16 r_port, u64 value, clib_bihash_kv_16_8_t *kv)
static uword nat44_ed_classify_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword pool_elts(void *v)
Number of active elements in a pool.