FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
map.h File Reference
+ Include dependency graph for map.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  map_domain_t
 
struct  map_domain_extra_t
 
struct  map_main_pre_resolved_t_
 A pre-resolved next-hop. More...
 
struct  map_main_t
 
struct  map_trace_t
 

Macros

#define MAP_SKIP_IP6_LOOKUP   1
 
#define MAP_ERR_GOOD   0
 
#define MAP_ERR_BAD_POOL_SIZE   -1
 
#define MAP_ERR_BAD_HT_RATIO   -2
 
#define MAP_ERR_BAD_LIFETIME   -3
 
#define MAP_ERR_BAD_BUFFERS   -4
 
#define MAP_ERR_BAD_BUFFERS_TOO_LARGE   -5
 
#define MAP_ERR_UNSUPPORTED   -6
 
#define MAP_REASS_INDEX_NONE   ((u16)0xffff)
 
#define foreach_map_error
 

Typedefs

typedef struct map_main_pre_resolved_t_ map_main_pre_resolved_t
 A pre-resolved next-hop. More...
 

Enumerations

enum  map_domain_flags_e { MAP_DOMAIN_PREFIX = 1 << 0, MAP_DOMAIN_TRANSLATION = 1 << 1, MAP_DOMAIN_RFC6052 = 1 << 2 }
 
enum  map_domain_counter_t { MAP_DOMAIN_IPV4_FRAGMENT = 0, MAP_DOMAIN_COUNTER_RX = 0, MAP_DOMAIN_COUNTER_TX, MAP_N_DOMAIN_COUNTER }
 
enum  map_error_t { MAP_N_ERROR }
 

Functions

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)
 
int map_delete_domain (u32 map_domain_index)
 
int map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t *tep, bool is_add)
 
int map_if_enable_disable (bool is_enable, u32 sw_if_index, bool is_translation)
 
u8format_map_trace (u8 *s, va_list *args)
 
int map_param_set_fragmentation (bool inner, bool ignore_df)
 
int map_param_set_icmp (ip4_address_t *ip4_err_relay_src)
 
int map_param_set_icmp6 (u8 enable_unreachable)
 
void map_pre_resolve (ip4_address_t *ip4, ip6_address_t *ip6, bool is_del)
 
int map_param_set_security_check (bool enable, bool fragments)
 
int map_param_set_traffic_class (bool copy, u8 tc)
 
int map_param_set_tcp (u16 tcp_mss)
 
 STATIC_ASSERT ((sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES), "MAP domain fits in one cacheline")
 
u64 map_error_counter_get (u32 node_index, map_error_t map_error)
 
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_always_inline u64 map_get_pfx (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u64 map_get_pfx_net (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u64 map_get_sfx (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_always_inline u32 map_get_ip4 (ip6_address_t *addr, u16 prefix_len)
 
static_always_inline map_domain_tip4_map_get_domain (ip4_address_t *addr, u32 *map_domain_index, u8 *error)
 
static_always_inline map_domain_tip6_map_get_domain (ip6_address_t *addr, u32 *map_domain_index, u8 *error)
 
clib_error_tmap_plugin_api_hookup (vlib_main_t *vm)
 
void map_ip6_drop_pi (u32 pi)
 
static_always_inline void ip4_map_t_embedded_address (map_domain_t *d, ip6_address_t *ip6, const ip4_address_t *ip4)
 
static_always_inline u32 ip6_map_t_embedded_address (map_domain_t *d, ip6_address_t *addr)
 
static void map_domain_counter_lock (map_main_t *mm)
 
static void map_domain_counter_unlock (map_main_t *mm)
 
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)
 
static_always_inline void map_mss_clamping (tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
 
static_always_inline bool ip4_map_ip6_lookup_bypass (vlib_buffer_t *p0, ip4_header_t *ip)
 
static_always_inline bool ip6_map_ip4_lookup_bypass (vlib_buffer_t *p0, ip4_header_t *ip)
 

Variables

map_main_pre_resolved_t pre_resolved [FIB_PROTOCOL_MAX]
 Pre-resolved next hops for v4 and v6. More...
 
map_main_t map_main
 
vlib_node_registration_t ip4_map_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_node) More...
 
vlib_node_registration_t ip6_map_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_node) More...
 
vlib_node_registration_t ip4_map_t_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_node) More...
 
vlib_node_registration_t ip4_map_t_fragmented_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node) More...
 
vlib_node_registration_t ip4_map_t_tcp_udp_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node) More...
 
vlib_node_registration_t ip4_map_t_icmp_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node) More...
 
vlib_node_registration_t ip6_map_t_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_node) More...
 
vlib_node_registration_t ip6_map_t_fragmented_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node) More...
 
vlib_node_registration_t ip6_map_t_tcp_udp_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node) More...
 
vlib_node_registration_t ip6_map_t_icmp_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node) More...
 

Macro Definition Documentation

◆ foreach_map_error

#define foreach_map_error
Value:
/* Must be first. */ \
_(NONE, "valid MAP packets") \
_(BAD_PROTOCOL, "bad protocol") \
_(SEC_CHECK, "security check failed") \
_(ENCAP_SEC_CHECK, "encap security check failed") \
_(DECAP_SEC_CHECK, "decap security check failed") \
_(ICMP, "unable to translate ICMP") \
_(ICMP_RELAY, "unable to relay ICMP") \
_(UNKNOWN, "unknown") \
_(NO_BINDING, "no binding") \
_(NO_DOMAIN, "no domain") \
_(FRAGMENTED, "packet is a fragment") \
_(FRAGMENT_MEMORY, "could not cache fragment") \
_(FRAGMENT_MALFORMED, "fragment has unexpected format")\
_(FRAGMENT_DROPPED, "dropped cached fragment") \
_(MALFORMED, "malformed packet") \
_(DF_SET, "can't fragment, DF set") \
_(TIME_EXCEEDED, "time exceeded") \

Definition at line 211 of file map.h.

◆ MAP_ERR_BAD_BUFFERS

#define MAP_ERR_BAD_BUFFERS   -4

Definition at line 33 of file map.h.

◆ MAP_ERR_BAD_BUFFERS_TOO_LARGE

#define MAP_ERR_BAD_BUFFERS_TOO_LARGE   -5

Definition at line 34 of file map.h.

◆ MAP_ERR_BAD_HT_RATIO

#define MAP_ERR_BAD_HT_RATIO   -2

Definition at line 31 of file map.h.

◆ MAP_ERR_BAD_LIFETIME

#define MAP_ERR_BAD_LIFETIME   -3

Definition at line 32 of file map.h.

◆ MAP_ERR_BAD_POOL_SIZE

#define MAP_ERR_BAD_POOL_SIZE   -1

Definition at line 30 of file map.h.

◆ MAP_ERR_GOOD

#define MAP_ERR_GOOD   0

Definition at line 29 of file map.h.

◆ MAP_ERR_UNSUPPORTED

#define MAP_ERR_UNSUPPORTED   -6

Definition at line 35 of file map.h.

◆ MAP_REASS_INDEX_NONE

#define MAP_REASS_INDEX_NONE   ((u16)0xffff)

Definition at line 112 of file map.h.

◆ MAP_SKIP_IP6_LOOKUP

#define MAP_SKIP_IP6_LOOKUP   1

Definition at line 27 of file map.h.

Typedef Documentation

◆ map_main_pre_resolved_t

A pre-resolved next-hop.

Enumeration Type Documentation

◆ map_domain_counter_t

Enumerator
MAP_DOMAIN_IPV4_FRAGMENT 
MAP_DOMAIN_COUNTER_RX 
MAP_DOMAIN_COUNTER_TX 
MAP_N_DOMAIN_COUNTER 

Definition at line 117 of file map.h.

◆ map_domain_flags_e

Enumerator
MAP_DOMAIN_PREFIX 
MAP_DOMAIN_TRANSLATION 
MAP_DOMAIN_RFC6052 

Definition at line 58 of file map.h.

◆ map_error_t

Enumerator
MAP_N_ERROR 

Definition at line 231 of file map.h.

Function Documentation

◆ format_map_trace()

u8* format_map_trace ( u8 s,
va_list *  args 
)

Definition at line 1204 of file map.c.

+ Here is the call graph for this function:

◆ ip4_map_get_domain()

static_always_inline map_domain_t* ip4_map_get_domain ( ip4_address_t addr,
u32 map_domain_index,
u8 error 
)

Definition at line 340 of file map.h.

+ Here is the caller graph for this function:

◆ ip4_map_ip6_lookup_bypass()

static_always_inline bool ip4_map_ip6_lookup_bypass ( vlib_buffer_t p0,
ip4_header_t ip 
)

Definition at line 498 of file map.h.

+ Here is the caller graph for this function:

◆ ip4_map_t_embedded_address()

static_always_inline void ip4_map_t_embedded_address ( map_domain_t d,
ip6_address_t *  ip6,
const ip4_address_t ip4 
)

Definition at line 383 of file map.h.

+ Here is the caller graph for this function:

◆ ip6_map_get_domain()

static_always_inline map_domain_t* ip6_map_get_domain ( ip6_address_t *  addr,
u32 map_domain_index,
u8 error 
)

Definition at line 360 of file map.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_map_ip4_lookup_bypass()

static_always_inline bool ip6_map_ip4_lookup_bypass ( vlib_buffer_t p0,
ip4_header_t ip 
)

Definition at line 512 of file map.h.

+ Here is the caller graph for this function:

◆ ip6_map_t_embedded_address()

static_always_inline u32 ip6_map_t_embedded_address ( map_domain_t d,
ip6_address_t *  addr 
)

Definition at line 394 of file map.h.

+ Here is the caller graph for this function:

◆ map_add_del_psid()

int map_add_del_psid ( u32  map_domain_index,
u16  psid,
ip6_address_t *  tep,
bool  is_add 
)

Definition at line 235 of file map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_add_trace()

static void map_add_trace ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_buffer_t b,
u32  map_domain_index,
u16  port 
)
inlinestatic

Definition at line 248 of file map.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_create_domain()

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 
)

Definition at line 105 of file map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_delete_domain()

int map_delete_domain ( u32  map_domain_index)

Definition at line 204 of file map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_domain_counter_lock()

static void map_domain_counter_lock ( map_main_t mm)
inlinestatic

Definition at line 404 of file map.h.

+ Here is the caller graph for this function:

◆ map_domain_counter_unlock()

static void map_domain_counter_unlock ( map_main_t mm)
inlinestatic

Definition at line 412 of file map.h.

+ Here is the caller graph for this function:

◆ map_error_counter_get()

u64 map_error_counter_get ( u32  node_index,
map_error_t  map_error 
)

Definition at line 1036 of file map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_get_ip4()

static_always_inline u32 map_get_ip4 ( ip6_address_t *  addr,
u16  prefix_len 
)

Definition at line 329 of file map.h.

+ Here is the caller graph for this function:

◆ map_get_pfx()

static_always_inline u64 map_get_pfx ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 275 of file map.h.

+ Here is the caller graph for this function:

◆ map_get_pfx_net()

static_always_inline u64 map_get_pfx_net ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 290 of file map.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_get_sfx()

static_always_inline u64 map_get_sfx ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 300 of file map.h.

+ Here is the caller graph for this function:

◆ map_get_sfx_net()

static_always_inline u64 map_get_sfx_net ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 322 of file map.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_if_enable_disable()

int map_if_enable_disable ( bool  is_enable,
u32  sw_if_index,
bool  is_translation 
)

Definition at line 450 of file map_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_ip6_drop_pi()

void map_ip6_drop_pi ( u32  pi)

Definition at line 542 of file ip6_map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_mss_clamping()

static_always_inline void map_mss_clamping ( tcp_header_t tcp,
ip_csum_t sum,
u16  mss_clamping 
)

Definition at line 449 of file map.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_param_set_fragmentation()

int map_param_set_fragmentation ( bool  inner,
bool  ignore_df 
)

Definition at line 247 of file map_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_param_set_icmp()

int map_param_set_icmp ( ip4_address_t ip4_err_relay_src)

Definition at line 272 of file map_api.c.

+ Here is the caller graph for this function:

◆ map_param_set_icmp6()

int map_param_set_icmp6 ( u8  enable_unreachable)

Definition at line 299 of file map_api.c.

+ Here is the caller graph for this function:

◆ map_param_set_security_check()

int map_param_set_security_check ( bool  enable,
bool  fragments 
)

Definition at line 336 of file map_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_param_set_tcp()

int map_param_set_tcp ( u16  tcp_mss)

Definition at line 386 of file map_api.c.

+ Here is the caller graph for this function:

◆ map_param_set_traffic_class()

int map_param_set_traffic_class ( bool  copy,
u8  tc 
)

Definition at line 361 of file map_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_plugin_api_hookup()

clib_error_t* map_plugin_api_hookup ( vlib_main_t vm)

Definition at line 525 of file map_api.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_pre_resolve()

void map_pre_resolve ( ip4_address_t ip4,
ip6_address_t *  ip6,
bool  is_del 
)

Definition at line 407 of file map.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ map_send_all_to_node()

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 
)

Definition at line 420 of file map.h.

+ Here is the call graph for this function:

◆ STATIC_ASSERT()

STATIC_ASSERT ( (sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES ,
"MAP domain fits in one cacheline"   
)

Variable Documentation

◆ ip4_map_node

(constructor) VLIB_REGISTER_NODE (ip4_map_node)

Definition at line 344 of file ip4_map.c.

◆ ip4_map_t_fragmented_node

vlib_node_registration_t ip4_map_t_fragmented_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node)

Definition at line 701 of file ip4_map_t.c.

◆ ip4_map_t_icmp_node

vlib_node_registration_t ip4_map_t_icmp_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node)

Definition at line 722 of file ip4_map_t.c.

◆ ip4_map_t_node

vlib_node_registration_t ip4_map_t_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_node)

Definition at line 764 of file ip4_map_t.c.

◆ ip4_map_t_tcp_udp_node

vlib_node_registration_t ip4_map_t_tcp_udp_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node)

Definition at line 743 of file ip4_map_t.c.

◆ ip6_map_node

(constructor) VLIB_REGISTER_NODE (ip6_map_node)

Definition at line 821 of file ip6_map.c.

◆ ip6_map_t_fragmented_node

vlib_node_registration_t ip6_map_t_fragmented_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)

Definition at line 697 of file ip6_map_t.c.

◆ ip6_map_t_icmp_node

vlib_node_registration_t ip6_map_t_icmp_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)

Definition at line 719 of file ip6_map_t.c.

◆ ip6_map_t_node

vlib_node_registration_t ip6_map_t_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)

Definition at line 770 of file ip6_map_t.c.

◆ ip6_map_t_tcp_udp_node

vlib_node_registration_t ip6_map_t_tcp_udp_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)

Definition at line 741 of file ip6_map_t.c.

◆ map_main

map_main_t map_main

Definition at line 27 of file map.c.

◆ pre_resolved

Pre-resolved next hops for v4 and v6.

Why these are global and not per-domain is beyond me.

Pre-resolved next hops for v4 and v6.

Definition at line 283 of file map.c.