35 ip4_and_gre_header_t ip4_and_gre;
63 s =
format (s,
"GRE: tunnel %d len %d src %U dst %U sa-id %d",
101 u32 *from, *to_next, n_left_from, n_left_to_next;
114 while (n_left_from > 0)
123 while (n_left_from >= 4 && n_left_to_next >= 2)
128 u32 bi0, next0, bi1, next1;
129 __attribute__ ((unused))
u8 error0, error1;
130 u16 gre_protocol0, gre_protocol1;
168 gre_protocol0 = clib_net_to_host_u16 (0x01);
171 gre_protocol1 = clib_net_to_host_u16 (0x01);
222 error0 = IPSEC_GRE_ERROR_NONE;
223 error1 = IPSEC_GRE_ERROR_NONE;
233 tr->
sa_id = t->local_sa_id;
244 tr->
sa_id = t->local_sa_id;
248 to_next, n_left_to_next,
249 bi0, bi1, next0, next1);
252 while (n_left_from > 0 && n_left_to_next > 0)
258 __attribute__ ((unused))
u8 error0;
261 bi0 = to_next[0] = from[0];
269 gre_protocol0 = clib_net_to_host_u16 (0x01);
295 error0 = IPSEC_GRE_ERROR_NONE;
305 tr->
sa_id = t->local_sa_id;
309 to_next, n_left_to_next,
317 IPSEC_GRE_ERROR_PKTS_ENCAP, frame->
n_vectors);
338 u32 dev_instance = va_arg (*args,
u32);
339 return format (s,
"ipsec-gre%d", dev_instance);
345 u32 dev_instance = va_arg (*args,
u32);
348 s =
format (s,
"IPSEC-GRE tunnel: id %d\n", dev_instance);
354 .name =
"IPSec GRE tunnel device",
377 memset (igm, 0,
sizeof (igm[0]));
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
u8 * format_ipsec_gre_tx_trace(u8 *s, va_list *args)
u8 runtime_data[0]
Function dependent node-runtime data.
vnet_main_t * vnet_get_main(void)
L2-GRE over IPSec packet processing.
#define VNET_HW_INTERFACE_CLASS(x,...)
VLIB_DEVICE_TX_FUNCTION_MULTIARCH(ipsec_gre_device_class, ipsec_gre_interface_tx)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
static clib_error_t * ipsec_gre_init(vlib_main_t *vm)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static uword ipsec_gre_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPSec-GRE tunnel interface tx function.
static clib_error_t * ipsec_gre_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define IPSEC_GRE_OUTPUT_NEXT_ESP_ENCRYPT
ipsec_gre_tunnel_t * tunnels
pool of tunnel instances
ip4_and_gre_header_t ip4_and_gre
#define VLIB_INIT_FUNCTION(x)
IPv4 and GRE header union.
ipsec_gre_main_t ipsec_gre_main
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vnet_hw_interface_class_t ipsec_gre_hw_interface_class
static u8 * format_ipsec_gre_tunnel_name(u8 *s, va_list *args)
#define vlib_call_init_function(vm, x)
ip4_address_t dst
tunnel dst IPv4 address
uword * tunnel_by_key
hash mapping src/dst addr pair to tunnel
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * ipsec_gre_input_init(vlib_main_t *vm)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
VNET_DEVICE_CLASS(ipsec_gre_device_class)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
ip4_address_t src
tunnel src IPv4 address
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
vlib_node_registration_t ipsec_gre_input_node
(constructor) VLIB_REGISTER_NODE (ipsec_gre_input_node)
clib_error_t * ip_main_init(vlib_main_t *vm)
#define CLIB_PREFETCH(addr, size, type)
u32 sa_id
tunnel IPSec SA id
#define VLIB_BUFFER_IS_TRACED
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define hash_create(elts, value_bytes)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
vnet_device_class_t ipsec_gre_device_class
IPSec-GRE tunnel parameters.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vnet_main_t * vnet_main
convenience
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 tunnel_id
Tunnel-id / index in tunnel vector.
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
ipsec_gre_main_t * ipsec_gre_get_main(vlib_main_t *vm)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
vlib_main_t * vlib_main
convenience
static u8 * format_ipsec_gre_device(u8 *s, va_list *args)