31 u32 dev_instance = va_arg (*args,
u32);
39 #define foreach_ipsec_if_tx_error \ 40 _(TX, "good packets transmitted") 43 #define _(sym,string) string, 50 #define _(sym,str) IPSEC_IF_OUTPUT_ERROR_##sym, 80 u32 *from, *to_next = 0, next_index;
81 u32 n_left_from, sw_if_index0, last_sw_if_index = ~0;
83 u32 n_bytes = 0, n_packets = 0;
89 while (n_left_from > 0)
95 while (n_left_from > 0 && n_left_to_next > 0)
102 bi0 = to_next[0] = from[0];
112 next0 = IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT;
125 thread_index, sw_if_index0,
127 last_sw_if_index = sw_if_index0;
143 n_left_to_next, bi0, next0);
148 if (last_sw_if_index != ~0)
153 last_sw_if_index, n_packets, n_bytes);
249 (
u8 *) args,
sizeof (*args));
261 u32 hw_if_index = ~0;
266 u32 tx_fib_index = ~0;
275 return VNET_API_ERROR_INVALID_VALUE;
278 if (tx_fib_index == ~((
u32) 0))
279 return VNET_API_ERROR_NO_SUCH_FIB;
293 return VNET_API_ERROR_INSTANCE_IN_USE;
358 ipsec_hw_class.index,
365 IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT);
367 ASSERT (slot == IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT);
384 return VNET_API_ERROR_INVALID_VALUE;
428 return VNET_API_ERROR_INVALID_VALUE;
433 return VNET_API_ERROR_INVALID_VALUE;
448 return VNET_API_ERROR_INVALID_VALUE;
468 return VNET_API_ERROR_INVALID_VALUE;
490 return VNET_API_ERROR_SYSCALL_ERROR_1;
521 return VNET_API_ERROR_INVALID_VALUE;
535 u32 sa_index, old_sa_index;
545 return VNET_API_ERROR_INVALID_VALUE;
550 clib_warning (
"SA with ID %u is already in use", sa_id);
551 return VNET_API_ERROR_INVALID_VALUE;
557 clib_warning (
"IPsec interface not supported with IPv6 endpoints");
558 return VNET_API_ERROR_UNIMPLEMENTED;
593 clib_warning (
"IPsec backend add/del callback returned error");
594 return VNET_API_ERROR_SYSCALL_ERROR_1;
static char * ipsec_if_tx_error_strings[]
VNET_DEVICE_CLASS(ipsec_device_class, static)
#define hash_set(h, key, value)
ipsec_tunnel_if_t * tunnel_interfaces
ip46_address_t tunnel_src_addr
#define hash_unset(h, key)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
vnet_interface_main_t interface_main
int ipsec_set_interface_sa(vnet_main_t *vnm, u32 hw_if_index, u32 sa_id, u8 is_outbound)
ipsec_integ_alg_t integ_alg
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u8 remote_crypto_key[128]
int ipsec_add_del_tunnel_if(ipsec_add_del_tunnel_args_t *args)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
u32 ipsec_get_sa_index_by_sa_id(u32 sa_id)
void ip4_register_protocol(u32 protocol, u32 node_index)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
uword * ipsec_if_pool_index_by_key
#define clib_memcpy(d, s, n)
clib_error_t * ipsec_tunnel_if_init(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
vlib_combined_counter_main_t * combined_sw_if_counters
vnet_hw_interface_flags_t flags
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
int ipsec_set_interface_key(vnet_main_t *vnm, u32 hw_if_index, ipsec_if_set_key_type_t type, u8 alg, u8 *key)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
static uword ipsec_if_tx_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
static clib_error_t * ipsec_admin_up_down_function(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define foreach_ipsec_if_tx_error
u32 esp4_encrypt_node_index
clib_error_t * ipsec_check_support_cb(ipsec_main_t *im, ipsec_sa_t *sa)
#define pool_put(P, E)
Free an object E in pool P.
#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).
ip46_address_t tunnel_dst_addr
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
ipsec_crypto_alg_t crypto_alg
clib_error_t * ipsec_add_del_sa_sess_cb(ipsec_main_t *im, u32 sa_index, u8 is_add)
static_always_inline uword vlib_get_thread_index(void)
u8 * format_ipsec_if_tx_trace(u8 *s, va_list *args)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
vlib_node_registration_t ipsec_if_input_node
(constructor) VLIB_REGISTER_NODE (ipsec_if_input_node)
#define clib_warning(format, args...)
uword * sa_index_by_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.
uword * ipsec_if_real_dev_by_show_dev
u8 * default_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Return a complete, zero-length (aka dummy) rewrite.
int ipsec_add_del_ipsec_gre_tunnel(vnet_main_t *vnm, ipsec_add_del_ipsec_gre_tunnel_args_t *args)
#define hash_create(elts, value_bytes)
u8 ipsec_is_sa_used(u32 sa_index)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static int ipsec_add_del_tunnel_if_rpc_callback(ipsec_add_del_tunnel_args_t *a)
ipsec_integ_alg_t integ_alg
int ipsec_add_del_tunnel_if_internal(vnet_main_t *vnm, ipsec_add_del_tunnel_args_t *args, u32 *sw_if_index)
ipsec_protocol_t protocol
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VNET_HW_INTERFACE_CLASS(ipsec_hw_class)
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.
a point 2 point interface
ipsec_crypto_alg_t crypto_alg
static u8 * format_ipsec_name(u8 *s, va_list *args)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
#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.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
static uword pool_elts(void *v)
Number of active elements in a pool.