FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
gre.c File Reference
+ Include dependency graph for gre.c:

Go to the source code of this file.

Data Structures

struct  ip4_and_gre_union_t
 
struct  ip6_and_gre_union_t
 
struct  gre_tx_trace_t
 

Macros

#define gre_error(n, s)   s,
 

Enumerations

enum  gre_encap_next_t { GRE_ENCAP_NEXT_L2_MIDCHAIN, GRE_ENCAP_N_NEXT }
 

Functions

u8format_gre_tx_trace (u8 *s, va_list *args)
 
u8format_gre_protocol (u8 *s, va_list *args)
 
u8format_gre_header_with_length (u8 *s, va_list *args)
 
u8format_gre_header (u8 *s, va_list *args)
 
uword unformat_gre_protocol_host_byte_order (unformat_input_t *input, va_list *args)
 
uword unformat_gre_protocol_net_byte_order (unformat_input_t *input, va_list *args)
 
uword unformat_gre_header (unformat_input_t *input, va_list *args)
 
static int gre_proto_from_vnet_link (vnet_link_t link)
 
static u8gre_build_rewrite (vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
 
static void gre44_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static void gre64_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static void grex4_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static void gre46_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static void gre66_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static void grex6_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 
static adj_midchain_fixup_t gre_get_fixup (fib_protocol_t fproto, vnet_link_t lt)
 return the appropriate fixup function given the overlay (link-type) and underlay (fproto) combination More...
 
void gre_update_adj (vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
 
adj_walk_rc_t mgre_mk_complete_walk (adj_index_t ai, void *data)
 
adj_walk_rc_t mgre_mk_incomplete_walk (adj_index_t ai, void *data)
 
void mgre_update_adj (vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
 
static_always_inline u32 gre_encap_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, gre_tunnel_type_t type)
 TX function. More...
 
VLIB_NODE_FN() gre_teb_encap_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
VLIB_NODE_FN() gre_erspan_encap_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static u8format_gre_tunnel_name (u8 *s, va_list *args)
 
static u8format_gre_device (u8 *s, va_list *args)
 
static int gre_tunnel_desc (u32 sw_if_index, ip46_address_t *src, ip46_address_t *dst, u8 *is_l2)
 
 VNET_DEVICE_CLASS (gre_device_class)
 
 VNET_HW_INTERFACE_CLASS (gre_hw_interface_class)
 
 VNET_HW_INTERFACE_CLASS (mgre_hw_interface_class)
 
static void add_protocol (gre_main_t *gm, gre_protocol_t protocol, char *protocol_name)
 
static clib_error_tgre_init (vlib_main_t *vm)
 

Variables

gre_main_t gre_main
 
static char * gre_error_strings []
 
vlib_node_registration_t gre_teb_encap_node
 (constructor) VLIB_REGISTER_NODE (gre_teb_encap_node) More...
 
vlib_node_registration_t gre_erspan_encap_node
 (constructor) VLIB_REGISTER_NODE (gre_erspan_encap_node) More...
 

Macro Definition Documentation

◆ gre_error

#define gre_error (   n,
 
)    s,

Enumeration Type Documentation

◆ gre_encap_next_t

Enumerator
GRE_ENCAP_NEXT_L2_MIDCHAIN 
GRE_ENCAP_N_NEXT 

Definition at line 491 of file gre.c.

Function Documentation

◆ add_protocol()

static void add_protocol ( gre_main_t gm,
gre_protocol_t  protocol,
char *  protocol_name 
)
static

Definition at line 780 of file gre.c.

◆ format_gre_device()

static u8* format_gre_device ( u8 s,
va_list *  args 
)
static

Definition at line 714 of file gre.c.

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

◆ format_gre_header()

u8* format_gre_header ( u8 s,
va_list *  args 
)

Definition at line 126 of file gre.c.

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

◆ format_gre_header_with_length()

u8* format_gre_header_with_length ( u8 s,
va_list *  args 
)

Definition at line 95 of file gre.c.

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

◆ format_gre_protocol()

u8* format_gre_protocol ( u8 s,
va_list *  args 
)

Definition at line 80 of file gre.c.

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

◆ format_gre_tunnel_name()

static u8* format_gre_tunnel_name ( u8 s,
va_list *  args 
)
static

Definition at line 700 of file gre.c.

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

◆ format_gre_tx_trace()

u8 * format_gre_tx_trace ( u8 s,
va_list *  args 
)

Definition at line 66 of file gre.c.

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

◆ gre44_fixup()

static void gre44_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 279 of file gre.c.

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

◆ gre46_fixup()

static void gre46_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 329 of file gre.c.

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

◆ gre64_fixup()

static void gre64_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 297 of file gre.c.

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

◆ gre66_fixup()

static void gre66_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 347 of file gre.c.

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

◆ gre_build_rewrite()

static u8* gre_build_rewrite ( vnet_main_t vnm,
u32  sw_if_index,
vnet_link_t  link_type,
const void *  dst_address 
)
static

Definition at line 212 of file gre.c.

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

◆ gre_encap_inline()

static_always_inline u32 gre_encap_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
gre_tunnel_type_t  type 
)

TX function.

Only called for L2 payload including TEB or ERSPAN. L3 traffic uses the adj-midchains.

Definition at line 502 of file gre.c.

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

◆ gre_erspan_encap_node()

VLIB_NODE_FN() gre_erspan_encap_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 662 of file gre.c.

+ Here is the call graph for this function:

◆ gre_get_fixup()

static adj_midchain_fixup_t gre_get_fixup ( fib_protocol_t  fproto,
vnet_link_t  lt 
)
static

return the appropriate fixup function given the overlay (link-type) and underlay (fproto) combination

Definition at line 384 of file gre.c.

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

◆ gre_init()

static clib_error_t* gre_init ( vlib_main_t vm)
static

Definition at line 797 of file gre.c.

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

◆ gre_proto_from_vnet_link()

static int gre_proto_from_vnet_link ( vnet_link_t  link)
static

Definition at line 189 of file gre.c.

+ Here is the caller graph for this function:

◆ gre_teb_encap_node()

VLIB_NODE_FN() gre_teb_encap_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 655 of file gre.c.

+ Here is the call graph for this function:

◆ gre_tunnel_desc()

static int gre_tunnel_desc ( u32  sw_if_index,
ip46_address_t *  src,
ip46_address_t *  dst,
u8 is_l2 
)
static

Definition at line 724 of file gre.c.

+ Here is the call graph for this function:

◆ gre_update_adj()

void gre_update_adj ( vnet_main_t vnm,
u32  sw_if_index,
adj_index_t  ai 
)

Definition at line 404 of file gre.c.

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

◆ grex4_fixup()

static void grex4_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 315 of file gre.c.

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

◆ grex6_fixup()

static void grex6_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Definition at line 365 of file gre.c.

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

◆ mgre_mk_complete_walk()

adj_walk_rc_t mgre_mk_complete_walk ( adj_index_t  ai,
void *  data 
)

Definition at line 429 of file gre.c.

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

◆ mgre_mk_incomplete_walk()

adj_walk_rc_t mgre_mk_incomplete_walk ( adj_index_t  ai,
void *  data 
)

Definition at line 449 of file gre.c.

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

◆ mgre_update_adj()

void mgre_update_adj ( vnet_main_t vnm,
u32  sw_if_index,
adj_index_t  ai 
)

Definition at line 463 of file gre.c.

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

◆ unformat_gre_header()

uword unformat_gre_header ( unformat_input_t input,
va_list *  args 
)

Definition at line 165 of file gre.c.

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

◆ unformat_gre_protocol_host_byte_order()

uword unformat_gre_protocol_host_byte_order ( unformat_input_t input,
va_list *  args 
)

Definition at line 134 of file gre.c.

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

◆ unformat_gre_protocol_net_byte_order()

uword unformat_gre_protocol_net_byte_order ( unformat_input_t input,
va_list *  args 
)

Definition at line 154 of file gre.c.

+ Here is the call graph for this function:

◆ VNET_DEVICE_CLASS()

VNET_DEVICE_CLASS ( gre_device_class  )
+ Here is the caller graph for this function:

◆ VNET_HW_INTERFACE_CLASS() [1/2]

VNET_HW_INTERFACE_CLASS ( gre_hw_interface_class  )
+ Here is the caller graph for this function:

◆ VNET_HW_INTERFACE_CLASS() [2/2]

VNET_HW_INTERFACE_CLASS ( mgre_hw_interface_class  )

Variable Documentation

◆ gre_error_strings

char* gre_error_strings[]
static
Initial value:
= {
#define gre_error(n,s)
gre_error (NONE, "no error")
gre_error (UNKNOWN_PROTOCOL, "unknown protocol")
gre_error (UNSUPPORTED_VERSION, "unsupported version")
gre_error (PKTS_DECAP, "GRE input packets decapsulated")
gre_error (PKTS_ENCAP, "GRE output packets encapsulated")
gre_error (NO_SUCH_TUNNEL, "GRE input packets dropped due to missing tunnel")
}
option version
Definition: sample.api:19
vl_api_ip_proto_t protocol
Definition: lb_types.api:71
#define gre_error(n, s)

Definition at line 649 of file gre.c.

◆ gre_erspan_encap_node

vlib_node_registration_t gre_erspan_encap_node
Initial value:
=
{
.name = "gre-erspan-encap",
.vector_size = sizeof (u32),
.format_trace = format_gre_tx_trace,
.n_errors = GRE_N_ERROR,
.error_strings = gre_error_strings,
.n_next_nodes = GRE_ENCAP_N_NEXT,
.next_nodes = {
[GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain",
},
}
unsigned int u32
Definition: types.h:88
vl_api_fib_path_type_t type
Definition: fib_types.api:123
u8 * format_gre_tx_trace(u8 *s, va_list *args)
Definition: gre.c:66
static char * gre_error_strings[]
Definition: gre.c:649

(constructor) VLIB_REGISTER_NODE (gre_erspan_encap_node)

Definition at line 683 of file gre.c.

◆ gre_main

gre_main_t gre_main

Definition at line 26 of file gre.c.

◆ gre_teb_encap_node

vlib_node_registration_t gre_teb_encap_node
Initial value:
=
{
.name = "gre-teb-encap",
.vector_size = sizeof (u32),
.format_trace = format_gre_tx_trace,
.n_errors = GRE_N_ERROR,
.error_strings = gre_error_strings,
.n_next_nodes = GRE_ENCAP_N_NEXT,
.next_nodes = {
[GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain",
},
}
unsigned int u32
Definition: types.h:88
vl_api_fib_path_type_t type
Definition: fib_types.api:123
u8 * format_gre_tx_trace(u8 *s, va_list *args)
Definition: gre.c:66
static char * gre_error_strings[]
Definition: gre.c:649

(constructor) VLIB_REGISTER_NODE (gre_teb_encap_node)

Definition at line 670 of file gre.c.