FD.io VPP  v21.01.1
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_icmp_set_fn_t) (ip6_header_t *ip6, ip4_header_t *ip4, void *ctx)
 IPv6 to IPv4 set call back function type. More...
 
typedef int(* ip6_to_ip4_tcp_udp_set_fn_t) (vlib_buffer_t *b, ip6_header_t *ip6, ip4_header_t *ip4, void *ctx)
 

Functions

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. More...
 
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. 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 (u32 ip_version_traffic_class_and_flow_label)
 Translate TOS value from IPv6 to IPv4. More...
 
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. 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

◆ frag_id_6to4

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

Definition at line 49 of file ip6_to_ip4.h.

Typedef Documentation

◆ ip6_to_ip4_icmp_set_fn_t

typedef int(* ip6_to_ip4_icmp_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.

◆ ip6_to_ip4_tcp_udp_set_fn_t

typedef int(* ip6_to_ip4_tcp_udp_set_fn_t) (vlib_buffer_t *b, ip6_header_t *ip6, ip4_header_t *ip4, void *ctx)

Definition at line 30 of file ip6_to_ip4.h.

Function Documentation

◆ icmp6_to_icmp()

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 
)
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 350 of file ip6_to_ip4.h.

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

◆ icmp6_to_icmp_header()

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 237 of file ip6_to_ip4.h.

+ Here is the caller graph for this function:

◆ ip6_get_port()

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

Get L4 information like port number or ICMP id from IPv6 packet.

Parameters
ip6IPv6 header.
buffer_lenBuffer length.
ip_protocolL4 protocol
src_portL4 src port or icmp id
dst_postL4 dst port or icmp id
icmp_type_or_tcp_flagsICMP type or TCP flags, if applicable
tcp_ack_numberTCP ack number, if applicable
tcp_seq_numberTCP seq number, if applicable
Returns
1 on success, 0 otherwise.

Definition at line 117 of file ip6_to_ip4.h.

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

◆ ip6_parse()

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.

Parameters
vmvlib main
bvlib buffer
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 65 of file ip6_to_ip4.h.

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

◆ ip6_translate_tos()

static_always_inline u8 ip6_translate_tos ( u32  ip_version_traffic_class_and_flow_label)

Translate TOS value from IPv6 to IPv4.

Parameters
ip_version_traffic_class_and_flow_labelin network byte order
Returns
IPv4 TOS value.

Definition at line 332 of file ip6_to_ip4.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ icmp6_to_icmp_updater_pointer_table

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 35 of file ip6_to_ip4.h.