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;
106 u16 l2_gre_protocol_ethertype = clib_net_to_host_u16 (0x01);
117 while (n_left_from > 0)
126 while (n_left_from >= 4 && n_left_to_next >= 2)
131 u32 bi0, next0, bi1, next1;
132 __attribute__ ((unused))
u8 error0, error1;
183 h0->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
189 h1->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
218 error0 = IPSEC_GRE_ERROR_NONE;
219 error1 = IPSEC_GRE_ERROR_NONE;
229 tr->
sa_id = t->local_sa_id;
240 tr->
sa_id = t->local_sa_id;
244 to_next, n_left_to_next,
245 bi0, bi1, next0, next1);
248 while (n_left_from > 0 && n_left_to_next > 0)
254 __attribute__ ((unused))
u8 error0;
256 bi0 = to_next[0] = from[0];
272 h0->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
288 error0 = IPSEC_GRE_ERROR_NONE;
298 tr->
sa_id = t->local_sa_id;
302 to_next, n_left_to_next,
310 IPSEC_GRE_ERROR_PKTS_ENCAP, frame->
n_vectors);
331 u32 dev_instance = va_arg (*args,
u32);
332 return format (s,
"ipsec-gre%d", dev_instance);
338 u32 dev_instance = va_arg (*args,
u32);
341 s =
format (s,
"IPSEC-GRE tunnel: id %d\n", dev_instance);
347 .name =
"IPSec GRE tunnel device",
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)
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
L2-GRE over IPSec packet processing.
#define VNET_HW_INTERFACE_CLASS(x,...)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
VLIB_DEVICE_TX_FUNCTION_MULTIARCH(ipsec_gre_device_class, ipsec_gre_interface_tx)
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
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.
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
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
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.
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)