FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
ip6_to_ip4.h File Reference

IPv6 to IPv4 translation. More...

+ Include dependency graph for ip6_to_ip4.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define frag_id_6to4(id)   ((id) ^ ((id) >> 16))
 

Typedefs

typedef int(* ip6_to_ip4_set_fn_t) (ip6_header_t *ip6, ip4_header_t *ip4, void *ctx)
 IPv6 to IPv4 set call back function type. More...
 

Functions

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. More...
 
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. More...
 
static_always_inline int icmp6_to_icmp_header (icmp46_header_t *icmp, ip6_header_t **inner_ip6)
 Convert type and code value from ICMP6 to ICMP4. More...
 
static_always_inline u8 ip6_translate_tos (const ip6_header_t *ip6)
 Translate TOS value from IPv6 to IPv4. More...
 
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. More...
 
static int ip6_to_ip4_fragmented (vlib_buffer_t *p, ip6_to_ip4_set_fn_t fn, void *ctx)
 Translate IPv6 fragmented packet to IPv4. More...
 
static int ip6_to_ip4_tcp_udp (vlib_buffer_t *p, ip6_to_ip4_set_fn_t fn, void *ctx, u8 udp_checksum)
 Translate IPv6 UDP/TCP packet to IPv4. More...
 
static int ip6_to_ip4 (vlib_buffer_t *p, ip6_to_ip4_set_fn_t fn, void *ctx)
 Translate IPv6 packet to IPv4 (IP header only). More...
 

Variables

static u8 icmp6_to_icmp_updater_pointer_table []
 

Detailed Description

IPv6 to IPv4 translation.

Definition in file ip6_to_ip4.h.

Macro Definition Documentation

#define frag_id_6to4 (   id)    ((id) ^ ((id) >> 16))

Definition at line 45 of file ip6_to_ip4.h.

Typedef Documentation

typedef int(* ip6_to_ip4_set_fn_t) (ip6_header_t *ip6, ip4_header_t *ip4, void *ctx)

IPv6 to IPv4 set call back function type.

Definition at line 27 of file ip6_to_ip4.h.

Function Documentation

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 
)
inlinestatic

Translate ICMP6 packet to ICMP4.

Parameters
pBuffer to translate.
fnThe function to translate outer header.
ctxA context passed in the outer header translate function.
inner_fnThe function to translate inner header.
inner_ctxA context passed in the inner header translate function.
Returns
0 on success, non-zero value otherwise.

Definition at line 249 of file ip6_to_ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline int icmp6_to_icmp_header ( icmp46_header_t *  icmp,
ip6_header_t **  inner_ip6 
)

Convert type and code value from ICMP6 to ICMP4.

Parameters
icmpICMP header.
inner_ip6Inner IPv6 header if present, 0 otherwise.
Returns
0 on success, non-zero value otherwise.

Definition at line 136 of file ip6_to_ip4.h.

+ Here is the caller graph for this function:

static u16 ip6_get_port ( ip6_header_t ip6,
u8  sender,
u16  buffer_len 
)
inlinestatic

Get TCP/UDP port number or ICMP id from IPv6 packet.

Parameters
ip6IPv6 header.
sender1 get sender port, 0 get receiver port.
buffer_lenBuffer length.
Returns
Port number on success, 0 otherwise.

Definition at line 90 of file ip6_to_ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
ip6IPv6 header.
buff_lenBuffer length.
l4_protocolL4 protocol number.
l4_offsetL4 header offset.
frag_hdr_offsetFragment header offset if present, 0 otherwise.
Returns
0 on success, non-zero value otherwise.

Definition at line 59 of file ip6_to_ip4.h.

+ Here is the caller graph for this function:

static int ip6_to_ip4 ( vlib_buffer_t p,
ip6_to_ip4_set_fn_t  fn,
void *  ctx 
)
inlinestatic

Translate IPv6 packet to IPv4 (IP header only).

Parameters
pBuffer to translate.
fnThe function to translate header.
ctxA context passed in the header translate function.
Returns
0 on success, non-zero value otherwise.

Definition at line 578 of file ip6_to_ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int ip6_to_ip4_fragmented ( vlib_buffer_t p,
ip6_to_ip4_set_fn_t  fn,
void *  ctx 
)
inlinestatic

Translate IPv6 fragmented packet to IPv4.

Parameters
pBuffer to translate.
fnThe function to translate header.
ctxA context passed in the header translate function.
Returns
0 on success, non-zero value otherwise.

Definition at line 425 of file ip6_to_ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int ip6_to_ip4_tcp_udp ( vlib_buffer_t p,
ip6_to_ip4_set_fn_t  fn,
void *  ctx,
u8  udp_checksum 
)
inlinestatic

Translate IPv6 UDP/TCP packet to IPv4.

Parameters
pBuffer to translate.
fnThe function to translate header.
ctxA context passed in the header translate function.
Returns
0 on success, non-zero value otherwise.

Definition at line 481 of file ip6_to_ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline u8 ip6_translate_tos ( const ip6_header_t ip6)

Translate TOS value from IPv6 to IPv4.

Parameters
ip6IPv6 header.
Returns
IPv4 TOS value.

Definition at line 231 of file ip6_to_ip4.h.

+ Here is the caller graph for this function:

Variable Documentation

u8 icmp6_to_icmp_updater_pointer_table[]
static
Initial value:
=
{ 0, 1, ~0, ~0,
2, 2, 9, 8,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
24, 24, 24, 24,
24, 24, 24, 24,
24, 24, 24, 24,
24, 24, 24, 24
}

Definition at line 31 of file ip6_to_ip4.h.