65 IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : ip6->
protocol,
86 IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : ip6->
protocol,
149 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
158 while (n_left_from > 0)
162 while (n_left_from > 0 && n_left_to_next > 0)
173 pi0 = to_next[0] = from[0];
178 error0 = MAP_ERROR_NONE;
194 error0 = MAP_ERROR_ICMP;
203 error0 = MAP_ERROR_ICMP;
220 map_t.map_domain_index, 1,
230 to_next, n_left_to_next, pi0,
245 ip6_frag_hdr_t *frag;
259 frag = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
275 sizeof (*ip4) - l4_offset +
sizeof (*ip6));
278 clib_host_to_net_u16 (frag_offset |
282 (l4_protocol == IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : l4_protocol;
292 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
299 while (n_left_from > 0)
303 while (n_left_from > 0 && n_left_to_next > 0)
309 pi0 = to_next[0] = from[0];
320 p0->
error = error_node->
errors[MAP_ERROR_FRAGMENT_DROPPED];
336 to_next, n_left_to_next, pi0,
368 if (l4_protocol == IP_PROTOCOL_TCP)
373 csum = tcp->checksum;
377 checksum = &tcp->checksum;
397 ip6_frag_hdr_t *hdr = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
415 sizeof (*ip4) +
sizeof (*ip6) - l4_offset);
423 if (!udp_checksum && l4_protocol == IP_PROTOCOL_UDP)
445 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
452 while (n_left_from > 0)
456 while (n_left_from > 0 && n_left_to_next > 0)
462 pi0 = to_next[0] = from[0];
489 to_next, n_left_to_next, pi0,
500 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
509 while (n_left_from > 0)
513 while (n_left_from > 0 && n_left_to_next > 0)
522 ip6_frag_hdr_t *frag0;
526 pi0 = to_next[0] = from[0];
531 error0 = MAP_ERROR_NONE;
559 error0 == MAP_ERROR_NONE ? MAP_ERROR_MALFORMED : error0;
565 sizeof (*ip60) -
vnet_buffer (p0)->map_t.v6.l4_offset;
579 MAP_ERROR_NONE ? MAP_ERROR_FRAGMENT_MEMORY : error0;
585 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP))
600 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP))
618 sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : error0;
620 if (((icmp46_header_t *)
624 || ((icmp46_header_t *)
627 code == ICMP6_echo_request)
638 error0 = MAP_ERROR_BAD_PROTOCOL;
654 error0 == MAP_ERROR_NONE ? MAP_ERROR_SEC_CHECK : error0;
665 && (error0 == MAP_ERROR_NONE))
683 clib_net_to_host_u16 (ip60->
691 to_next, n_left_to_next, pi0,
700 #define _(sym, string) string, 708 .name =
"ip6-map-t-fragmented",
709 .vector_size =
sizeof (
u32),
729 .name =
"ip6-map-t-icmp",
730 .vector_size =
sizeof (
u32),
750 .name =
"ip6-map-t-tcp-udp",
751 .vector_size =
sizeof (
u32),
770 .arc_name =
"ip6-unicast",
771 .node_name =
"ip6-map-t",
778 .vector_size =
sizeof(
u32),
#define map_ip4_reass_lock()
static_always_inline u8 ip6_translate_tos(const ip6_header_t *ip6)
Translate TOS value from IPv6 to IPv4.
static uword ip6_map_t_tcp_udp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u16 ip6_get_port(ip6_header_t *ip6, u8 sender, u16 buffer_len)
Get TCP/UDP port number or ICMP id from IPv6 packet.
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 icmp6_to_icmp(vlib_buffer_t *p, ip6_to_ip4_set_fn_t fn, void *ctx, ip6_to_ip4_set_fn_t inner_fn, void *inner_ctx)
Translate ICMP6 packet to ICMP4.
static_always_inline map_domain_t * ip6_map_get_domain(ip6_address_t *addr, u32 *map_domain_index, u8 *error)
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)
vlib_error_t * errors
Vector of errors for this node.
struct _tcp_header tcp_header_t
IPv4 to IPv6 translation.
static_always_inline u32 ip6_map_t_embedded_address(map_domain_t *d, ip6_address_t *addr)
#define static_always_inline
static_always_inline u32 map_get_ip4(ip6_address_t *addr, u16 prefix_len)
vlib_combined_counter_main_t * domain_counters
static int map_ip6_to_ip4_tcp_udp(vlib_buffer_t *p, bool udp_checksum)
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_always_inline i32 ip6_map_fragment_get(ip6_header_t *ip6, ip6_frag_hdr_t *frag, map_domain_t *d)
#define ip6_frag_hdr_more(hdr)
#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.
#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 int ip6_map_fragment_cache(ip6_header_t *ip6, ip6_frag_hdr_t *frag, map_domain_t *d, u16 port)
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.
map_ip4_reass_t * map_ip4_reass_get(u32 src, u32 dst, u16 fragment_id, u8 protocol, u32 **pi_to_drop)
#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.
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.
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
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.
#define map_ip4_reass_unlock()
u8 * format_map_trace(u8 *s, va_list *args)
IPv6 to IPv4 translation.
#define u8_ptr_add(ptr, index)
#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 map_ip6_to_ip4_fragmented(vlib_buffer_t *p)
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 u16_net_add(u, val)
VNET_FEATURE_INIT(ip4_map_t_feature, static)
#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS
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)