26 #ifdef MAP_SKIP_IP6_LOOKUP 45 || clib_host_to_net_u16 (ip->
length) < 28))
54 && (clib_net_to_host_u16 (port) < (0x1 << (16 - d->
psid_offset))))
56 *error = MAP_ERROR_ENCAP_SEC_CHECK;
74 u32 vtcfl = 0x6 << 28;
76 vtcfl |=
vnet_buffer (p)->ip.flow_hash & 0x000fffff;
78 return (clib_host_to_net_u32 (vtcfl));
92 u32 checksum = ip->
checksum + clib_host_to_net_u16 (0x0100);
93 checksum += checksum >= 0xffff;
97 *error = ttl <= 0 ? IP4_ERROR_TIME_EXPIRED : *error;
130 ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
133 *error = MAP_ERROR_DF_SET;
149 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
159 while (n_left_from > 0)
162 while (n_left_from > 0 && n_left_to_next > 0)
167 u8 error0 = MAP_ERROR_NONE;
172 u32 map_domain_index0 = ~0;
174 bool free_original_buffer0 =
false;
175 u32 *frag_from0, frag_left0;
177 pi0 = to_next[0] = from[0];
201 if (ip40->
protocol == IP_PROTOCOL_TCP)
220 u16 dp40 = clib_net_to_host_u16 (port0);
223 if (dal60 == 0 && dar60 == 0 && error0 == MAP_ERROR_NONE)
224 error0 = MAP_ERROR_NO_BINDING;
234 ip6h0->
protocol = IP_PROTOCOL_IP_IN_IP;
237 ip6h0->
dst_address.as_u64[0] = clib_host_to_net_u64 (dal60);
238 ip6h0->
dst_address.as_u64[1] = clib_host_to_net_u64 (dar60);
249 sizeof (*ip6h0) > d0->
mtu)))
255 if (error0 == MAP_ERROR_NONE)
257 free_original_buffer0 =
true;
268 map_domain_index0, 1,
287 if (free_original_buffer0)
296 frag_from0 = buffer0;
297 frag_left0 =
vec_len (buffer0);
299 while (frag_left0 > 0)
301 while (frag_left0 > 0 && n_left_to_next > 0)
304 i0 = to_next[0] = frag_from0[0];
311 error_node->
errors[error0];
313 to_next, n_left_to_next,
331 .arc_name =
"ip4-unicast",
332 .node_name =
"ip4-map",
340 .vector_size =
sizeof(
u32),
344 .n_errors = MAP_N_ERROR,
345 .error_counters = map_error_counters,
350 #ifdef MAP_SKIP_IP6_LOOKUP 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 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.
static_always_inline u64 map_get_pfx(map_domain_t *d, u32 addr, u16 port)
u16 current_length
Nbytes between current data and the end of this buffer.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static_always_inline map_domain_t * ip4_map_get_domain(ip4_address_t *addr, u32 *map_domain_index, u8 *error)
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
vlib_error_t * errors
Vector of errors for this node.
struct _tcp_header tcp_header_t
IPv4 to IPv6 translation.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define static_always_inline
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
vlib_combined_counter_main_t * domain_counters
static void * ip4_next_header(ip4_header_t *i)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static_always_inline u32 ip4_map_vtcfl(ip4_header_t *ip4, vlib_buffer_t *p)
#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).
static uword ip4_map(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
ip_frag_error_t ip6_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 l2unfragmentablesize, u32 **buffer)
sll srl srl sll sra u16x4 i
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.
static void ip4_map_decrement_ttl(ip4_header_t *ip, u8 *error)
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.
vlib_main_t vlib_node_runtime_t * node
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static_always_inline u16 ip4_map_port_and_security_check(map_domain_t *d, vlib_buffer_t *b0, u8 *error)
static u32 ip4_map_fragment(vlib_main_t *vm, u32 bi, u16 mtu, bool df, u32 **buffers, u8 *error)
static_always_inline bool ip4_map_ip6_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
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)
VNET_FEATURE_INIT(ip4_map_feature, static)
#define VNET_FEATURES(...)
static_always_inline void map_mss_clamping(tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
A collection of combined counters.
ip_frag_error_t ip4_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 l2unfragmentablesize, u32 **buffer)
#define vec_foreach(var, vec)
Vector iterator.
#define IP4_HEADER_FLAG_DONT_FRAGMENT
static_always_inline u64 map_get_sfx(map_domain_t *d, u32 addr, u16 port)
static void vlib_buffer_free_one(vlib_main_t *vm, u32 buffer_index)
Free one buffer Shorthand to free a single buffer chain.
static_always_inline void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip_csum_fold(ip_csum_t c)