46 #define foreach_nat66_out2in_error \ 47 _(OUT2IN_PACKETS, "good out2in packets processed") \ 48 _(NO_TRANSLATION, "no translation") \ 53 #define _(sym,str) NAT66_OUT2IN_ERROR_##sym, 60 #define _(sym,string) string, 76 u32 n_left_from, *from, *to_next;
78 u32 pkts_processed = 0;
86 while (n_left_from > 0)
92 while (n_left_from > 0 && n_left_to_next > 0)
98 u16 l4_offset0, frag_offset0;
101 u32 sw_if_index0, fib_index0;
104 icmp46_header_t *icmp0;
125 b0->
error = node->
errors[NAT66_OUT2IN_ERROR_UNKNOWN];
140 if (l4_protocol0 == IP_PROTOCOL_UDP)
145 else if (l4_protocol0 == IP_PROTOCOL_TCP)
148 checksum0 = &tcp0->checksum;
150 else if (l4_protocol0 == IP_PROTOCOL_ICMP6)
152 icmp0 = (icmp46_header_t *)
u8_ptr_add (ip60, l4_offset0);
153 checksum0 = &icmp0->checksum;
170 thread_index, sm0 - nm->
sm, 1,
176 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
188 n_left_to_next, bi0, next0);
194 NAT66_OUT2IN_ERROR_OUT2IN_PACKETS,
202 .name =
"nat66-out2in",
203 .vector_size =
sizeof (
u32),
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
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.
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
struct _tcp_header tcp_header_t
static u8 * format_nat66_out2in_trace(u8 *s, va_list *args)
static_always_inline int ip6_parse(const ip6_header_t *ip6, u32 buff_len, u8 *l4_protocol, u16 *l4_offset, u16 *frag_hdr_offset)
Parse some useful information from IPv6 header.
static uword nat66_out2in_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static char * nat66_out2in_error_strings[]
u16 current_length
Nbytes between current data and the end of this buffer.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
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.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
VLIB_NODE_FUNCTION_MULTIARCH(nat66_out2in_node, nat66_out2in_node_fn)
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
IPv6 to IPv4 translation.
#define u8_ptr_add(ptr, index)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
vlib_combined_counter_main_t session_counters
Session counters.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define foreach_nat66_out2in_error
nat66_static_mapping_t * sm
Static mapping pool.
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
NAT66 global declarations.
nat66_static_mapping_t * nat66_static_mapping_get(ip6_address_t *addr, u32 fib_index, u8 is_local)
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 vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_node_registration_t nat66_out2in_node
(constructor) VLIB_REGISTER_NODE (nat66_out2in_node)
static u16 ip_csum_fold(ip_csum_t c)
static ip_csum_t ip_csum_add_even(ip_csum_t c, ip_csum_t x)