|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
74 if (
ip6->src_address.as_u64[0] !=
80 ip4->dst_address.as_u32 =
82 ip4->src_address.as_u32 = ip4_sadr;
96 if (
ip6->dst_address.as_u64[0] !=
103 ip4->dst_address.as_u32 = inner_ip4_dadr;
104 ip4->src_address.as_u32 =
138 pi0 = to_next[0] =
from[0];
143 error0 = MAP_ERROR_NONE;
156 NULL, NULL, NULL, NULL))
161 error0 = MAP_ERROR_ICMP;
169 error0 = MAP_ERROR_ICMP;
191 map_t.map_domain_index, 1,
201 to_next, n_left_to_next, pi0,
206 return frame->n_vectors;
216 ip6_frag_hdr_t *frag;
241 ip4->ip_version_and_header_length =
246 sizeof (*
ip4) - l4_offset +
sizeof (*
ip6));
247 ip4->fragment_id = frag_id;
248 ip4->flags_and_fragment_offset =
249 clib_host_to_net_u16 (frag_offset |
251 ip4->ttl =
ip6->hop_limit;
253 (l4_protocol == IP_PROTOCOL_ICMP6) ? IP_PROTOCOL_ICMP : l4_protocol;
280 pi0 = to_next[0] =
from[0];
290 p0->
error = error_node->
errors[MAP_ERROR_FRAGMENT_DROPPED];
311 to_next, n_left_to_next, pi0,
316 return frame->n_vectors;
338 ip6_address_t old_src, old_dst;
346 if (l4_protocol == IP_PROTOCOL_TCP)
351 csum = tcp->checksum;
355 checksum = &tcp->checksum;
363 old_src.as_u64[0] =
ip6->src_address.as_u64[0];
364 old_src.as_u64[1] =
ip6->src_address.as_u64[1];
365 old_dst.as_u64[0] =
ip6->dst_address.as_u64[0];
366 old_dst.as_u64[1] =
ip6->dst_address.as_u64[1];
375 ip6_frag_hdr_t *hdr = (ip6_frag_hdr_t *)
u8_ptr_add (
ip6, frag_offset);
391 u32 map_domain_index = -1;
398 ip4->ip_version_and_header_length =
403 sizeof (*
ip4) +
sizeof (*
ip6) - l4_offset);
404 ip4->fragment_id = fragment_id;
405 ip4->flags_and_fragment_offset =
flags;
406 ip4->ttl =
ip6->hop_limit;
407 ip4->protocol = l4_protocol;
450 pi0 = to_next[0] =
from[0];
482 to_next, n_left_to_next, pi0,
487 return frame->n_vectors;
516 ip6_frag_hdr_t *frag0;
520 pi0 = to_next[0] =
from[0];
525 error0 = MAP_ERROR_NONE;
552 ICMP6_time_exceeded_ttl_exceeded_in_transit,
554 p0->
error = error_node->
errors[MAP_ERROR_TIME_EXCEEDED];
566 error0 == MAP_ERROR_NONE ? MAP_ERROR_MALFORMED : error0;
571 sizeof (*ip60) -
vnet_buffer (p0)->map_t.v6.l4_offset;
581 map_port0 = l4_src_port;
586 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_TCP))
594 map_port0 = l4_src_port;
598 (
vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_UDP))
606 map_port0 = l4_src_port;
613 sizeof (icmp46_header_t) ? MAP_ERROR_MALFORMED : error0;
615 if (((icmp46_header_t *)
619 || ((icmp46_header_t *)
622 type == ICMP6_echo_request)
623 map_port0 = l4_src_port;
629 error0 = MAP_ERROR_BAD_PROTOCOL;
645 error0 == MAP_ERROR_NONE ? MAP_ERROR_SEC_CHECK : error0;
655 clib_net_to_host_u16 (ip60->
663 ICMP6_destination_unreachable_source_address_failed_policy,
682 to_next, n_left_to_next, pi0,
687 return frame->n_vectors;
693 .name =
"ip6-map-t-fragmented",
694 .vector_size =
sizeof (
u32),
698 .n_errors = MAP_N_ERROR,
699 .error_counters = map_error_counters,
715 .name =
"ip6-map-t-icmp",
716 .vector_size =
sizeof (
u32),
720 .n_errors = MAP_N_ERROR,
721 .error_counters = map_error_counters,
737 .name =
"ip6-map-t-tcp-udp",
738 .vector_size =
sizeof (
u32),
742 .n_errors = MAP_N_ERROR,
743 .error_counters = map_error_counters,
758 .arc_name =
"ip6-unicast",
759 .node_name =
"ip6-map-t",
767 .vector_size =
sizeof(
u32),
771 .n_errors = MAP_N_ERROR,
772 .error_counters = map_error_counters,
@ IP6_MAPT_ICMP_NEXT_IP4_REWRITE
@ IP6_MAPT_FRAGMENTED_NEXT_IP4_REWRITE
#define ip6_frag_hdr_more(hdr)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define u8_ptr_add(ptr, index)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static int map_ip6_to_ip4_tcp_udp(vlib_main_t *vm, vlib_buffer_t *p, bool udp_checksum)
void icmp6_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
static uword ip6_map_t(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
@ IP6_MAPT_NEXT_MAPT_FRAGMENTED
static uword ip6_map_t_tcp_udp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
struct _tcp_header tcp_header_t
@ VLIB_NODE_TYPE_INTERNAL
@ IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG
@ IP6_MAPT_FRAGMENTED_NEXT_IP4_LOOKUP
vlib_main_t vlib_node_runtime_t * node
static uword ip6_map_t_icmp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ IP6_MAPT_ICMP_NEXT_DROP
@ IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG
static_always_inline bool ip6_map_ip4_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
static_always_inline map_domain_t * ip6_map_get_domain(ip6_address_t *addr, u32 *map_domain_index, u8 *error)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
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.
@ IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP
static_always_inline u32 ip6_map_t_embedded_address(map_domain_t *d, ip6_address_t *addr)
static int map_ip6_to_ip4_fragmented(vlib_main_t *vm, vlib_buffer_t *p)
#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS
static void map_add_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, u32 map_domain_index, u16 port)
@ IP6_MAPT_ICMP_NEXT_IP4_FRAG
static_always_inline void map_mss_clamping(tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
vlib_node_registration_t ip6_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)
vlib_node_registration_t ip6_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)
vlib_error_t * errors
Vector of errors for this node.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
@ IP6_MAPT_FRAGMENTED_NEXT_DROP
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
@ IP6_MAPT_TCP_UDP_N_NEXT
static_always_inline map_domain_t * ip4_map_get_domain(ip4_address_t *addr, u32 *map_domain_index, u8 *error)
vlib_combined_counter_main_t * domain_counters
@ IP6_MAPT_FRAGMENTED_N_NEXT
#define ip6_frag_hdr_offset(hdr)
vnet_feature_config_main_t * cm
IPv6 to IPv4 translation.
vlib_node_registration_t ip6_map_t_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)
#define IP4_FRAG_NODE_NAME
VNET_FEATURE_INIT(ip6_map_t_feature, static)
struct _vlib_node_registration vlib_node_registration_t
static int ip6_to_ip4_set_icmp_cb(ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
u16 current_length
Nbytes between current data and the end of this buffer.
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
#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.
static_always_inline u32 map_get_ip4(ip6_address_t *addr, u16 prefix_len)
@ IP6_MAPT_NEXT_MAPT_ICMP
static uword ip6_map_t_fragmented(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
A collection of combined counters.
@ IP6_MAPT_NEXT_MAPT_TCP_UDP
vlib_put_next_frame(vm, node, next_index, 0)
static_always_inline u64 map_get_sfx_net(map_domain_t *d, u32 addr, u16 port)
vlib_node_registration_t ip6_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)
@ IP6_MAPT_ICMP_NEXT_IP4_LOOKUP
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
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.
#define VNET_FEATURES(...)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u16 ip4_header_checksum(ip4_header_t *i)
IPv4 to IPv6 translation.
static_always_inline u64 map_get_pfx_net(map_domain_t *d, u32 addr, u16 port)
ip6_mapt_fragmented_next_t
#define u16_net_add(u, val)
@ IP6_MAPT_TCP_UDP_NEXT_DROP
@ IP_FRAG_NEXT_IP4_LOOKUP
u16 udp_checksum(udp_header_t *uh, u32 udp_len, void *ih, u8 version)
static_always_inline u8 ip6_translate_tos(u32 ip_version_traffic_class_and_flow_label)
Translate TOS value from IPv6 to IPv4.
static ip_csum_t ip_csum_add_even(ip_csum_t c, ip_csum_t x)
#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 u16 ip_csum_fold(ip_csum_t c)
#define IP4_HEADER_FLAG_MORE_FRAGMENTS
static int ip6_to_ip4_set_inner_icmp_cb(ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
vl_api_fib_path_type_t type
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
u8 * format_map_trace(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
@ IP6_MAPT_TCP_UDP_NEXT_IP4_REWRITE
vl_api_wireguard_peer_flags_t flags