FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
gre.h File Reference
+ Include dependency graph for gre.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gre_protocol_info_t
 A GRE payload protocol registration. More...
 
struct  gre_tunnel_key_common_t_
 Elements of the GRE key that are common for v6 and v6 addresses. More...
 
struct  gre_tunnel_key4_t_
 Key for a IPv4 GRE Tunnel. More...
 
struct  gre_tunnel_key6_t_
 Key for a IPv6 GRE Tunnel We use a different type so that the V4 key hash is as small as possible. More...
 
union  gre_tunnel_key_t_
 Union of the two possible key types. More...
 
struct  gre_sn_t
 Used for GRE header seq number generation for ERSPAN encap. More...
 
struct  gre_sn_key_t
 Hash key for GRE header seq number generation for ERSPAN encap. More...
 
struct  gre_tunnel_t
 A representation of a GRE tunnel. More...
 
struct  next_info_t
 
struct  gre_main_t
 GRE related global data. More...
 
struct  mgre_walk_ctx_t_
 
struct  vnet_gre_tunnel_add_del_args_t
 

Macros

#define gre_error(n, s)   GRE_ERROR_##n,
 
#define foreach_gre_tunnel_type
 L3: GRE (i.e. More...
 
#define GTK_SESSION_ID_MAX   (0x3ff)
 The session ID is only a 10 bit value. More...
 
#define GRE_OUTPUT_NEXT_LOOKUP   1
 

Typedefs

typedef enum gre_tunnel_type_t_ gre_tunnel_type_t
 The GRE tunnel type. More...
 
typedef struct gre_tunnel_key_common_t_ gre_tunnel_key_common_t
 Elements of the GRE key that are common for v6 and v6 addresses. More...
 
typedef struct gre_tunnel_key4_t_ gre_tunnel_key4_t
 Key for a IPv4 GRE Tunnel. More...
 
typedef struct gre_tunnel_key6_t_ gre_tunnel_key6_t
 Key for a IPv6 GRE Tunnel We use a different type so that the V4 key hash is as small as possible. More...
 
typedef union gre_tunnel_key_t_ gre_tunnel_key_t
 Union of the two possible key types. More...
 
typedef struct mgre_walk_ctx_t_ mgre_walk_ctx_t
 

Enumerations

enum  gre_error_t { GRE_N_ERROR }
 
enum  gre_tunnel_type_t_ { foreach_gre_tunnel_type }
 The GRE tunnel type. More...
 

Functions

u8format_gre_tunnel_type (u8 *s, va_list *args)
 
 STATIC_ASSERT_SIZEOF (gre_tunnel_key_common_t, sizeof(u64))
 
 STATIC_ASSERT_SIZEOF (gre_tunnel_key4_t, 2 *sizeof(u64))
 
 STATIC_ASSERT_SIZEOF (gre_tunnel_key6_t, 5 *sizeof(u64))
 
typedef CLIB_PACKED (struct { ip4_header_t ip4;gre_header_t gre;}) ip4_and_gre_header_t
 IPv4 and GRE header. More...
 
typedef CLIB_PACKED (struct { ip6_header_t ip6;gre_header_t gre;}) ip6_and_gre_header_t
 IPv6 and GRE header. More...
 
static gre_protocol_info_tgre_get_protocol_info (gre_main_t *em, gre_protocol_t protocol)
 
clib_error_tgre_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
 
void gre_tunnel_stack (adj_index_t ai)
 gre_tunnel_stack 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 gre_register_input_protocol (vlib_main_t *vm, gre_protocol_t protocol, u32 node_index, gre_tunnel_type_t tunnel_type)
 
int vnet_gre_tunnel_add_del (vnet_gre_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
 
static void gre_mk_key4 (ip4_address_t src, ip4_address_t dst, u32 fib_index, gre_tunnel_type_t ttype, tunnel_mode_t tmode, u16 session_id, gre_tunnel_key4_t *key)
 
static int gre_match_key4 (const gre_tunnel_key4_t *key1, const gre_tunnel_key4_t *key2)
 
static void gre_mk_key6 (const ip6_address_t *src, const ip6_address_t *dst, u32 fib_index, gre_tunnel_type_t ttype, tunnel_mode_t tmode, u16 session_id, gre_tunnel_key6_t *key)
 
static int gre_match_key6 (const gre_tunnel_key6_t *key1, const gre_tunnel_key6_t *key2)
 
static void gre_mk_sn_key (const gre_tunnel_t *gt, gre_sn_key_t *key)
 

Variables

vnet_hw_interface_class_t gre_hw_interface_class
 
vnet_hw_interface_class_t mgre_hw_interface_class
 
gre_main_t gre_main
 
format_function_t format_gre_protocol
 
format_function_t format_gre_header
 
format_function_t format_gre_header_with_length
 
vlib_node_registration_t gre4_input_node
 (constructor) VLIB_REGISTER_NODE (gre4_input_node) More...
 
vlib_node_registration_t gre6_input_node
 (constructor) VLIB_REGISTER_NODE (gre6_input_node) More...
 
vlib_node_registration_t gre_erspan_encap_node
 (constructor) VLIB_REGISTER_NODE (gre_erspan_encap_node) More...
 
vlib_node_registration_t gre_teb_encap_node
 (constructor) VLIB_REGISTER_NODE (gre_teb_encap_node) More...
 
vnet_device_class_t gre_device_class
 
unformat_function_t unformat_gre_protocol_host_byte_order
 
unformat_function_t unformat_gre_protocol_net_byte_order
 
unformat_function_t unformat_gre_header
 
unformat_function_t unformat_pg_gre_header
 

Macro Definition Documentation

◆ foreach_gre_tunnel_type

#define foreach_gre_tunnel_type
Value:
_(L3, "L3") \
_(TEB, "TEB") \
_(ERSPAN, "ERSPAN") \

L3: GRE (i.e.

this tunnel is in L3 mode) TEB: Transparent Ethernet Bridging - the tunnel is in L2 mode ERSPAN: type 2 - the tunnel is for port mirror SPAN output. Each tunnel is associated with a session ID and expected to be used for encap and output of mirrored packet from a L2 network only. There is no support for receiving ERSPAN packets from a GRE ERSPAN tunnel

Definition at line 48 of file gre.h.

◆ gre_error

#define gre_error (   n,
 
)    GRE_ERROR_##n,

Definition at line 34 of file gre.h.

◆ GRE_OUTPUT_NEXT_LOOKUP

#define GRE_OUTPUT_NEXT_LOOKUP   1

Definition at line 362 of file gre.h.

◆ GTK_SESSION_ID_MAX

#define GTK_SESSION_ID_MAX   (0x3ff)

The session ID is only a 10 bit value.

Definition at line 161 of file gre.h.

Typedef Documentation

◆ gre_tunnel_key4_t

Key for a IPv4 GRE Tunnel.

◆ gre_tunnel_key6_t

Key for a IPv6 GRE Tunnel We use a different type so that the V4 key hash is as small as possible.

◆ gre_tunnel_key_common_t

Elements of the GRE key that are common for v6 and v6 addresses.

◆ gre_tunnel_key_t

Union of the two possible key types.

◆ gre_tunnel_type_t

The GRE tunnel type.

◆ mgre_walk_ctx_t

Enumeration Type Documentation

◆ gre_error_t

Enumerator
GRE_N_ERROR 

Definition at line 32 of file gre.h.

◆ gre_tunnel_type_t_

The GRE tunnel type.

Enumerator
foreach_gre_tunnel_type 

Definition at line 56 of file gre.h.

Function Documentation

◆ CLIB_PACKED() [1/2]

typedef CLIB_PACKED ( struct { ip4_header_t ip4;gre_header_t gre;}  )

IPv4 and GRE header.

◆ CLIB_PACKED() [2/2]

typedef CLIB_PACKED ( struct { ip6_header_t ip6;gre_header_t gre;}  )

IPv6 and GRE header.

◆ format_gre_tunnel_type()

u8* format_gre_tunnel_type ( u8 s,
va_list *  args 
)

Definition at line 29 of file interface.c.

+ Here is the caller graph for this function:

◆ gre_get_protocol_info()

static gre_protocol_info_t* gre_get_protocol_info ( gre_main_t em,
gre_protocol_t  protocol 
)
inlinestatic

Definition at line 314 of file gre.h.

+ Here is the caller graph for this function:

◆ gre_interface_admin_up_down()

clib_error_t* gre_interface_admin_up_down ( vnet_main_t vnm,
u32  hw_if_index,
u32  flags 
)

Definition at line 605 of file interface.c.

+ Here is the call graph for this function:

◆ gre_match_key4()

static int gre_match_key4 ( const gre_tunnel_key4_t key1,
const gre_tunnel_key4_t key2 
)
inlinestatic

Definition at line 396 of file gre.h.

+ Here is the caller graph for this function:

◆ gre_match_key6()

static int gre_match_key6 ( const gre_tunnel_key6_t key1,
const gre_tunnel_key6_t key2 
)
inlinestatic

Definition at line 419 of file gre.h.

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

◆ gre_mk_key4()

static void gre_mk_key4 ( ip4_address_t  src,
ip4_address_t  dst,
u32  fib_index,
gre_tunnel_type_t  ttype,
tunnel_mode_t  tmode,
u16  session_id,
gre_tunnel_key4_t key 
)
inlinestatic

Definition at line 381 of file gre.h.

+ Here is the caller graph for this function:

◆ gre_mk_key6()

static void gre_mk_key6 ( const ip6_address_t *  src,
const ip6_address_t *  dst,
u32  fib_index,
gre_tunnel_type_t  ttype,
tunnel_mode_t  tmode,
u16  session_id,
gre_tunnel_key6_t key 
)
inlinestatic

Definition at line 404 of file gre.h.

+ Here is the caller graph for this function:

◆ gre_mk_sn_key()

static void gre_mk_sn_key ( const gre_tunnel_t gt,
gre_sn_key_t key 
)
inlinestatic

Definition at line 428 of file gre.h.

+ Here is the caller graph for this function:

◆ gre_register_input_protocol()

void gre_register_input_protocol ( vlib_main_t vm,
gre_protocol_t  protocol,
u32  node_index,
gre_tunnel_type_t  tunnel_type 
)

Definition at line 499 of file node.c.

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

◆ gre_tunnel_stack()

void gre_tunnel_stack ( adj_index_t  ai)

gre_tunnel_stack

'stack' (resolve the recursion for) the tunnel's midchain adjacency

Definition at line 130 of file interface.c.

+ Here is the call graph for this function:
+ Here is the caller 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:

◆ mgre_mk_complete_walk()

adj_walk_rc_t mgre_mk_complete_walk ( adj_index_t  ai,
void *  data 
)

Definition at line 437 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 468 of file gre.c.

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

◆ STATIC_ASSERT_SIZEOF() [1/3]

STATIC_ASSERT_SIZEOF ( gre_tunnel_key4_t  ,
2 *  sizeofu64 
)

◆ STATIC_ASSERT_SIZEOF() [2/3]

STATIC_ASSERT_SIZEOF ( gre_tunnel_key6_t  ,
5 *  sizeofu64 
)

◆ STATIC_ASSERT_SIZEOF() [3/3]

STATIC_ASSERT_SIZEOF ( gre_tunnel_key_common_t  ,
sizeof(u64  
)

◆ vnet_gre_tunnel_add_del()

int vnet_gre_tunnel_add_del ( vnet_gre_tunnel_add_del_args_t a,
u32 sw_if_indexp 
)

Definition at line 580 of file interface.c.

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

Variable Documentation

◆ format_gre_header

format_function_t format_gre_header

Definition at line 339 of file gre.h.

◆ format_gre_header_with_length

format_function_t format_gre_header_with_length

Definition at line 340 of file gre.h.

◆ format_gre_protocol

format_function_t format_gre_protocol

Definition at line 338 of file gre.h.

◆ gre4_input_node

vlib_node_registration_t gre4_input_node

(constructor) VLIB_REGISTER_NODE (gre4_input_node)

Definition at line 454 of file node.c.

◆ gre6_input_node

vlib_node_registration_t gre6_input_node

(constructor) VLIB_REGISTER_NODE (gre6_input_node)

Definition at line 474 of file node.c.

◆ gre_device_class

vnet_device_class_t gre_device_class

◆ gre_erspan_encap_node

vlib_node_registration_t gre_erspan_encap_node

(constructor) VLIB_REGISTER_NODE (gre_erspan_encap_node)

Definition at line 708 of file gre.c.

◆ gre_hw_interface_class

vnet_hw_interface_class_t gre_hw_interface_class

◆ 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

(constructor) VLIB_REGISTER_NODE (gre_teb_encap_node)

Definition at line 695 of file gre.c.

◆ mgre_hw_interface_class

vnet_hw_interface_class_t mgre_hw_interface_class

◆ unformat_gre_header

unformat_function_t unformat_gre_header

Definition at line 354 of file gre.h.

◆ unformat_gre_protocol_host_byte_order

unformat_function_t unformat_gre_protocol_host_byte_order

Definition at line 350 of file gre.h.

◆ unformat_gre_protocol_net_byte_order

unformat_function_t unformat_gre_protocol_net_byte_order

Definition at line 351 of file gre.h.

◆ unformat_pg_gre_header

unformat_function_t unformat_pg_gre_header

Definition at line 355 of file gre.h.