27 #define MAP_SKIP_IP6_LOOKUP 1 29 #define MAP_ERR_GOOD 0 30 #define MAP_ERR_BAD_POOL_SIZE -1 31 #define MAP_ERR_BAD_HT_RATIO -2 32 #define MAP_ERR_BAD_LIFETIME -3 33 #define MAP_ERR_BAD_BUFFERS -4 34 #define MAP_ERR_BAD_BUFFERS_TOO_LARGE -5 35 #define MAP_ERR_UNSUPPORTED -6 39 ip6_address_t * ip6_src,
u8 ip6_src_len,
40 u8 ea_bits_len,
u8 psid_offset,
u8 psid_length,
100 "MAP domain fits in one cacheline");
112 #define MAP_REASS_INDEX_NONE ((u16)0xffff) 127 #ifdef MAP_SKIP_IP6_LOOKUP 211 #define foreach_map_error \ 213 _(NONE, "valid MAP packets") \ 214 _(BAD_PROTOCOL, "bad protocol") \ 215 _(SEC_CHECK, "security check failed") \ 216 _(ENCAP_SEC_CHECK, "encap security check failed") \ 217 _(DECAP_SEC_CHECK, "decap security check failed") \ 218 _(ICMP, "unable to translate ICMP") \ 219 _(ICMP_RELAY, "unable to relay ICMP") \ 220 _(UNKNOWN, "unknown") \ 221 _(NO_BINDING, "no binding") \ 222 _(NO_DOMAIN, "no domain") \ 223 _(FRAGMENTED, "packet is a fragment") \ 224 _(FRAGMENT_MEMORY, "could not cache fragment") \ 225 _(FRAGMENT_MALFORMED, "fragment has unexpected format")\ 226 _(FRAGMENT_DROPPED, "dropped cached fragment") \ 227 _(MALFORMED, "malformed packet") \ 228 _(DF_SET, "can't fragment, DF set") \ 229 _(TIME_EXCEEDED, "time exceeded") \ 233 #define _(sym,str) MAP_ERROR_##sym, 280 return clib_net_to_host_u64 (d->
rules[psid].as_u64[0]);
292 return clib_host_to_net_u64 (
map_get_pfx (d, clib_net_to_host_u32 (addr),
293 clib_net_to_host_u16 (port)));
306 return clib_net_to_host_u64 (d->
rules[psid].as_u64[1]);
308 return clib_net_to_host_u64 (d->
ip6_prefix.as_u64[1]);
311 return (clib_net_to_host_u64 (d->
ip6_prefix.as_u64[1]) | addr);
318 return ((
u64) addr << 16) | psid;
324 return clib_host_to_net_u64 (
map_get_sfx (d, clib_net_to_host_u32 (addr),
325 clib_net_to_host_u16 (port)));
331 ASSERT (prefix_len == 64 || prefix_len == 96);
332 if (prefix_len == 96)
333 return clib_host_to_net_u32 (clib_net_to_host_u64 (addr->as_u64[1]));
335 return clib_host_to_net_u32 (clib_net_to_host_u64 (addr->as_u64[1]) >>
347 *error = MAP_ERROR_NO_DOMAIN;
350 *map_domain_index = mdi;
367 *error = MAP_ERROR_NO_DOMAIN;
371 *map_domain_index = mdi;
388 ip6->as_u64[0] = d->
ip6_src.as_u64[0];
389 ip6->as_u64[1] = d->
ip6_src.as_u64[1];
424 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
427 n_left_from =
vec_len (pi_vector);
429 while (n_left_from > 0)
432 while (n_left_from > 0 && n_left_to_next > 0)
434 u32 pi0 = to_next[0] = from[0];
442 n_left_to_next, pi0, next);
452 u8 opt_len, opts_len, kind;
454 u16 mss_value_net = clib_host_to_net_u16 (mss_clamping);
460 data = (
u8 *) (tcp + 1);
461 for (; opts_len > 0; opts_len -= opt_len, data += opt_len)
478 if (opt_len < 2 || opt_len > opts_len)
484 mss = *(
u16 *) (data + 2);
500 #ifdef MAP_SKIP_IP6_LOOKUP 514 #ifdef MAP_SKIP_IP6_LOOKUP int map_param_set_icmp(ip4_address_t *ip4_err_relay_src)
static void map_add_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, u32 map_domain_index, u16 port)
fib_node_t node
Linkage into the FIB graph.
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
vl_api_wireguard_peer_flags_t flags
vlib_node_registration_t ip4_map_t_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_node)
static_always_inline u64 map_get_pfx(map_domain_t *d, u32 addr, u16 port)
volatile u32 * counter_lock
vlib_node_registration_t ip4_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node)
int map_if_enable_disable(bool is_enable, u32 sw_if_index, bool is_translation)
#define clib_memcpy_fast(a, b, c)
dpo_id_t dpo
The Load-balance object index to use to forward.
static_always_inline map_domain_t * ip6_map_get_domain(ip6_address_t *addr, u32 *map_domain_index, u8 *error)
int map_create_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags, u8 *tag)
manual_print typedef ip4_prefix
static void map_domain_counter_unlock(map_main_t *mm)
static_always_inline map_domain_t * ip4_map_get_domain(ip4_address_t *addr, u32 *map_domain_index, u8 *error)
static_always_inline bool ip6_map_ip4_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
uword * bm_trans_enabled_by_sw_if
struct _tcp_header tcp_header_t
#define clib_memcpy(d, s, n)
vlib_node_registration_t ip6_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)
static_always_inline void ip4_map_t_embedded_address(map_domain_t *d, ip6_address_t *ip6, const ip4_address_t *ip4)
manual_print typedef ip6_prefix
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
ip4_address_t icmp4_src_address
static_always_inline void map_send_all_to_node(vlib_main_t *vm, u32 *pi_vector, vlib_node_runtime_t *node, vlib_error_t *error, u32 next)
vlib_simple_counter_main_t icmp_relayed
A collection of simple counters.
#define clib_atomic_test_and_set(a)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
u32(* lookup)(struct lpm_ *lpm, void *addr_v, u8 pfxlen)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define clib_atomic_release(a)
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, bool is_add)
int map_param_set_traffic_class(bool copy, u8 tc)
static_always_inline u64 map_get_pfx_net(map_domain_t *d, u32 addr, u16 port)
static_always_inline u64 map_get_sfx_net(map_domain_t *d, u32 addr, u16 port)
static void mss_clamping(u16 mss_clamping, tcp_header_t *tcp, ip_csum_t *sum)
STATIC_ASSERT((sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES), "MAP domain fits in one cacheline")
#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.
An node in the FIB 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 ip4_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node)
vlib_node_registration_t ip4_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node)
lpm_t * ip6_src_prefix_tbl
vlib_node_registration_t ip6_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)
uword * bm_encap_enabled_by_sw_if
int map_param_set_fragmentation(bool inner, bool ignore_df)
u32 sibling
This object sibling index on the FIB entry's child dependency list.
u32 fib_node_index_t
A typedef of a 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 map_domain_counter_lock(map_main_t *mm)
void map_pre_resolve(ip4_address_t *ip4, ip6_address_t *ip6, bool is_del)
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
vlib_node_registration_t ip6_map_node
(constructor) VLIB_REGISTER_NODE (ip6_map_node)
static_always_inline bool ip4_map_ip6_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
void map_ip6_drop_pi(u32 pi)
static_always_inline void map_mss_clamping(tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
u8 * format_map_trace(u8 *s, va_list *args)
struct _vlib_node_registration vlib_node_registration_t
template key/value backing page structure
int map_param_set_security_check(bool enable, bool fragments)
int map_param_set_icmp6(u8 enable_unreachable)
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * map_plugin_api_hookup(vlib_main_t *vm)
fib_node_index_t fei
The FIB entry index of the next-hop.
map_domain_extra_t * domain_extras
VLIB buffer representation.
#define ip_csum_update(sum, old, new, type, field)
A collection of combined counters.
uword ip4_sv_reass_custom_next_index
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
vlib_simple_counter_main_t * simple_domain_counters
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
int map_param_set_tcp(u16 tcp_mss)
int map_delete_domain(u32 map_domain_index)
static_always_inline u64 map_get_sfx(map_domain_t *d, u32 addr, u16 port)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
vlib_node_registration_t ip6_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)
vlib_node_registration_t ip6_map_t_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
struct map_main_pre_resolved_t_ map_main_pre_resolved_t
A pre-resolved next-hop.
vl_api_interface_index_t sw_if_index