68 IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : ip6->
protocol,
89 IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : ip6->
protocol,
152 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
161 while (n_left_from > 0)
165 while (n_left_from > 0 && n_left_to_next > 0)
176 pi0 = to_next[0] = from[0];
181 error0 = MAP_ERROR_NONE;
197 error0 = MAP_ERROR_ICMP;
206 error0 = MAP_ERROR_ICMP;
228 map_t.map_domain_index, 1,
238 to_next, n_left_to_next, pi0,
253 ip6_frag_hdr_t *frag;
267 frag = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
283 sizeof (*ip4) - l4_offset +
sizeof (*ip6));
286 clib_host_to_net_u16 (frag_offset |
290 (l4_protocol == IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : l4_protocol;
300 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
307 while (n_left_from > 0)
311 while (n_left_from > 0 && n_left_to_next > 0)
317 pi0 = to_next[0] = from[0];
327 p0->
error = error_node->
errors[MAP_ERROR_FRAGMENT_DROPPED];
348 to_next, n_left_to_next, pi0,
382 if (l4_protocol == IP_PROTOCOL_TCP)
387 csum = tcp->checksum;
391 checksum = &tcp->checksum;
411 ip6_frag_hdr_t *hdr = (ip6_frag_hdr_t *)
u8_ptr_add (ip6, frag_offset);
427 u32 map_domain_index = -1;
439 sizeof (*ip4) +
sizeof (*ip6) - l4_offset);
447 if (!udp_checksum && l4_protocol == IP_PROTOCOL_UDP)
469 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
476 while (n_left_from > 0)
480 while (n_left_from > 0 && n_left_to_next > 0)
486 pi0 = to_next[0] = from[0];
518 to_next, n_left_to_next, pi0,
529 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
538 while (n_left_from > 0)
542 while (n_left_from > 0 && n_left_to_next > 0)
551 ip6_frag_hdr_t *frag0;
555 pi0 = to_next[0] = from[0];
560 error0 = MAP_ERROR_NONE;
588 error0 == MAP_ERROR_NONE ? MAP_ERROR_MALFORMED : error0;
594 sizeof (*ip60) -
vnet_buffer (p0)->map_t.v6.l4_offset;
608 MAP_ERROR_NONE ? MAP_ERROR_FRAGMENT_MEMORY : error0;
614 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP))
629 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP))
647 sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : error0;
649 if (((icmp46_header_t *)
653 || ((icmp46_header_t *)
656 code == ICMP6_echo_request)
667 error0 = MAP_ERROR_BAD_PROTOCOL;
683 error0 == MAP_ERROR_NONE ? MAP_ERROR_SEC_CHECK : error0;
694 && (error0 == MAP_ERROR_NONE))
712 clib_net_to_host_u16 (ip60->
720 to_next, n_left_to_next, pi0,
729 #define _(sym, string) string, 737 .name =
"ip6-map-t-fragmented",
738 .vector_size =
sizeof (
u32),
759 .name =
"ip6-map-t-icmp",
760 .vector_size =
sizeof (
u32),
781 .name =
"ip6-map-t-tcp-udp",
782 .vector_size =
sizeof (
u32),
802 .arc_name =
"ip6-unicast",
803 .node_name =
"ip6-map-t",
810 .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)
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_always_inline map_domain_t * ip4_map_get_domain(ip4_address_t *addr, u32 *map_domain_index, u8 *error)
static int ip6_to_ip4_set_icmp_cb(ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
static_always_inline bool ip6_map_ip4_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
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)
#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)
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 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_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
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 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)
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)
VNET_FEATURE_INIT(ip4_map_t_feature, static)
#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS
#define u16_net_add(u, val)
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)