110 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
119 while (n_left_from > 0)
123 while (n_left_from > 0 && n_left_to_next > 0)
134 pi0 = to_next[0] = from[0];
139 error0 = MAP_ERROR_NONE;
157 error0 = MAP_ERROR_ICMP;
165 error0 = MAP_ERROR_ICMP;
182 map_t.map_domain_index, 1,
192 to_next, n_left_to_next, pi0,
207 ip6_frag_hdr_t *frag;
218 (vm, p, ip6, p->
current_length, &l4_protocol, &l4_offset, &frag_offset))
221 frag = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
237 sizeof (*ip4) - l4_offset +
sizeof (*ip6));
240 clib_host_to_net_u16 (frag_offset |
244 (l4_protocol == IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : l4_protocol;
254 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
261 while (n_left_from > 0)
265 while (n_left_from > 0 && n_left_to_next > 0)
271 pi0 = to_next[0] = from[0];
282 p0->
error = error_node->
errors[MAP_ERROR_FRAGMENT_DROPPED];
298 to_next, n_left_to_next, pi0,
328 (vm, p, ip6, p->
current_length, &l4_protocol, &l4_offset, &frag_offset))
331 if (l4_protocol == IP_PROTOCOL_TCP)
336 csum = tcp->checksum;
340 checksum = &tcp->checksum;
360 ip6_frag_hdr_t *hdr = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
378 sizeof (*ip4) +
sizeof (*ip6) - l4_offset);
386 if (!udp_checksum && l4_protocol == IP_PROTOCOL_UDP)
408 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
415 while (n_left_from > 0)
419 while (n_left_from > 0 && n_left_to_next > 0)
425 pi0 = to_next[0] = from[0];
452 to_next, n_left_to_next, pi0,
463 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
472 while (n_left_from > 0)
476 while (n_left_from > 0 && n_left_to_next > 0)
485 ip6_frag_hdr_t *frag0;
489 pi0 = to_next[0] = from[0];
494 error0 = MAP_ERROR_NONE;
523 error0 == MAP_ERROR_NONE ? MAP_ERROR_MALFORMED : error0;
529 sizeof (*ip60) -
vnet_buffer (p0)->map_t.v6.l4_offset;
539 map_port0 = l4_src_port;
544 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP))
552 map_port0 = l4_src_port;
556 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP))
564 map_port0 = l4_src_port;
571 sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : error0;
573 if (((icmp46_header_t *)
577 || ((icmp46_header_t *)
580 code == ICMP6_echo_request)
581 map_port0 = l4_src_port;
587 error0 = MAP_ERROR_BAD_PROTOCOL;
603 error0 == MAP_ERROR_NONE ? MAP_ERROR_SEC_CHECK : error0;
613 clib_net_to_host_u16 (ip60->
627 to_next, n_left_to_next, pi0,
636 #define _(sym, string) string, 644 .name =
"ip6-map-t-fragmented",
645 .vector_size =
sizeof (
u32),
665 .name =
"ip6-map-t-icmp",
666 .vector_size =
sizeof (
u32),
686 .name =
"ip6-map-t-tcp-udp",
687 .vector_size =
sizeof (
u32),
706 .arc_name =
"ip6-unicast",
707 .node_name =
"ip6-map-t",
715 .vector_size =
sizeof(
u32),
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 void map_add_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, u32 map_domain_index, u16 port)
static uword ip6_map_t_tcp_udp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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.
u16 udp_checksum(udp_header_t *uh, u32 udp_len, void *ih, u8 version)
static int map_ip6_to_ip4_tcp_udp(vlib_main_t *vm, vlib_buffer_t *p, bool udp_checksum)
static_always_inline map_domain_t * ip6_map_get_domain(ip6_address_t *addr, u32 *map_domain_index, u8 *error)
u16 current_length
Nbytes between current data and the end of this buffer.
static uword ip6_map_t(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int ip6_to_ip4_set_icmp_cb(ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
static u16 ip6_get_port(vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6, u16 buffer_len, u8 *ip_protocol, u16 *src_port, u16 *dst_port, u8 *icmp_type_or_tcp_flags, u32 *tcp_ack_number, u32 *tcp_seq_number)
Get L4 information like port number or ICMP id from IPv6 packet.
vlib_error_t * errors
Vector of errors for this node.
struct _tcp_header tcp_header_t
IPv4 to IPv6 translation.
#define u8_ptr_add(ptr, index)
static_always_inline u32 ip6_map_t_embedded_address(map_domain_t *d, ip6_address_t *addr)
static_always_inline u32 map_get_ip4(ip6_address_t *addr, u16 prefix_len)
vlib_combined_counter_main_t * domain_counters
static_always_inline u8 ip6_translate_tos(u32 ip_version_traffic_class_and_flow_label)
Translate TOS value from IPv6 to IPv4.
vl_api_fib_path_type_t type
#define ip6_frag_hdr_more(hdr)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define IP4_FRAG_NODE_NAME
static_always_inline u64 map_get_pfx_net(map_domain_t *d, u32 addr, u16 port)
vlib_node_registration_t ip6_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)
static_always_inline u64 map_get_sfx_net(map_domain_t *d, u32 addr, u16 port)
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_node_registration_t ip6_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)
#define IP4_HEADER_FLAG_MORE_FRAGMENTS
#define VLIB_REGISTER_NODE(x,...)
static uword ip6_map_t_icmp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
VNET_FEATURE_INIT(ip6_map_t_feature, static)
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.
#define foreach_map_error
vlib_main_t vlib_node_runtime_t * node
static void * ip6_next_header(ip6_header_t *i)
vlib_node_registration_t ip6_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)
static int ip6_to_ip4_set_inner_icmp_cb(ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
#define ip6_frag_hdr_offset(hdr)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
u8 * format_map_trace(u8 *s, va_list *args)
IPv6 to IPv4 translation.
#define VNET_FEATURES(...)
static_always_inline void map_mss_clamping(tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
static uword ip6_map_t_fragmented(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static int icmp6_to_icmp(vlib_main_t *vm, vlib_buffer_t *p, ip6_to_ip4_icmp_set_fn_t fn, void *ctx, ip6_to_ip4_icmp_set_fn_t inner_fn, void *inner_ctx)
Translate ICMP6 packet to ICMP4.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
A collection of combined counters.
static char * map_t_error_strings[]
vlib_node_registration_t ip6_map_t_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)
#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define u16_net_add(u, val)
static_always_inline int ip6_parse(vlib_main_t *vm, vlib_buffer_t *b, 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.
ip6_mapt_fragmented_next_t
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
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)
static int map_ip6_to_ip4_fragmented(vlib_main_t *vm, vlib_buffer_t *p)