27 #ifndef CLIB_MARCH_VARIANT 39 ip4_and_gre_header_t ip4_and_gre;
67 s =
format (s,
"GRE: tunnel %d len %d src %U dst %U sa-id %d",
105 u32 *from, *to_next, n_left_from, n_left_to_next;
109 u16 l2_gre_protocol_ethertype = clib_net_to_host_u16 (GRE_PROTOCOL_teb);
115 n_left_from = frame->n_vectors;
118 next_index = node->cached_next_index;
120 while (n_left_from > 0)
129 while (n_left_from >= 4 && n_left_to_next >= 2)
134 u32 bi0, next0, bi1, next1;
135 __attribute__ ((unused))
u8 error0, error1;
186 h0->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
192 h1->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
221 error0 = IPSEC_GRE_ERROR_NONE;
222 error1 = IPSEC_GRE_ERROR_NONE;
232 tr->
sa_id = t->local_sa_id;
243 tr->
sa_id = t->local_sa_id;
247 to_next, n_left_to_next,
248 bi0, bi1, next0, next1);
251 while (n_left_from > 0 && n_left_to_next > 0)
257 __attribute__ ((unused))
u8 error0;
259 bi0 = to_next[0] = from[0];
275 h0->
ip4_and_gre.gre.protocol = l2_gre_protocol_ethertype;
291 error0 = IPSEC_GRE_ERROR_NONE;
301 tr->
sa_id = t->local_sa_id;
305 to_next, n_left_to_next,
313 IPSEC_GRE_ERROR_PKTS_ENCAP, frame->n_vectors);
315 return frame->n_vectors;
334 u32 dev_instance = va_arg (*args,
u32);
335 return format (s,
"ipsec-gre%d", dev_instance);
341 u32 dev_instance = va_arg (*args,
u32);
344 s =
format (s,
"IPSEC-GRE tunnel: id %d\n", dev_instance);
350 .name =
"IPSec GRE tunnel device",
358 #ifndef CLIB_MARCH_VARIANT u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
VNET_HW_INTERFACE_CLASS(ipsec_gre_hw_interface_class)
vnet_main_t * vnet_get_main(void)
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
L2-GRE over IPSec packet processing.
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
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 u8 * format_ipsec_gre_tx_trace(u8 *s, va_list *args)
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 VNET_DEVICE_CLASS_TX_FN(devclass)
#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)
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
VNET_DEVICE_CLASS_TX_FN() ipsec_gre_device_class(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPSec-GRE tunnel interface tx function.
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)
VLIB buffer representation.
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
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)