30 u32 dev_instance = va_arg (*args,
u32);
38 #define foreach_ipsec_if_tx_error \ 39 _(TX, "good packets transmitted") 42 #define _(sym,string) string, 49 #define _(sym,str) IPSEC_IF_OUTPUT_ERROR_##sym, 79 u32 *from, *to_next = 0, next_index;
80 u32 n_left_from, sw_if_index0, last_sw_if_index = ~0;
82 u32 n_bytes = 0, n_packets = 0;
88 while (n_left_from > 0)
94 while (n_left_from > 0 && n_left_to_next > 0)
101 bi0 = to_next[0] = from[0];
111 next0 = IPSEC_OUTPUT_NEXT_ESP_ENCRYPT;
124 thread_index, sw_if_index0,
126 last_sw_if_index = sw_if_index0;
142 n_left_to_next, bi0, next0);
147 if (last_sw_if_index != ~0)
152 last_sw_if_index, n_packets, n_bytes);
266 (
u8 *) args,
sizeof (*args));
278 u32 hw_if_index = ~0;
291 return VNET_API_ERROR_INVALID_VALUE;
294 memset (t, 0,
sizeof (*t));
305 return VNET_API_ERROR_INSTANCE_IN_USE;
312 memset (sa, 0,
sizeof (*sa));
337 memset (sa, 0,
sizeof (*sa));
366 ipsec_hw_class.index,
373 IPSEC_OUTPUT_NEXT_ESP_ENCRYPT);
375 ASSERT (slot == IPSEC_OUTPUT_NEXT_ESP_ENCRYPT);
392 return VNET_API_ERROR_INVALID_VALUE;
436 return VNET_API_ERROR_INVALID_VALUE;
441 return VNET_API_ERROR_INVALID_VALUE;
456 return VNET_API_ERROR_INVALID_VALUE;
459 memset (t, 0,
sizeof (*t));
476 return VNET_API_ERROR_INVALID_VALUE;
498 return VNET_API_ERROR_SYSCALL_ERROR_1;
529 return VNET_API_ERROR_INVALID_VALUE;
543 u32 sa_index, old_sa_index;
553 return VNET_API_ERROR_INVALID_VALUE;
558 clib_warning (
"SA with ID %u is already in use", sa_id);
559 return VNET_API_ERROR_INVALID_VALUE;
565 clib_warning (
"IPsec interface not supported with IPv6 endpoints");
566 return VNET_API_ERROR_UNIMPLEMENTED;
605 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
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#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)
u32 ipsec_get_sa_index_by_sa_id(u32 sa_id)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
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
clib_error_t * ipsec_tunnel_if_init(vlib_main_t *vm)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define VLIB_INIT_FUNCTION(x)
vlib_combined_counter_main_t * combined_sw_if_counters
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
ipsec_main_callbacks_t cb
int ipsec_set_interface_key(vnet_main_t *vnm, u32 hw_if_index, ipsec_if_set_key_type_t type, u8 alg, u8 *key)
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
clib_error_t *(* check_support_cb)(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 (general version).
ipsec_crypto_alg_t crypto_alg
static_always_inline uword vlib_get_thread_index(void)
u32 esp_encrypt_node_index
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...)
#define clib_memcpy(a, b, c)
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)
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)
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 *(* add_del_sa_sess_cb)(u32 sa_index, u8 is_add)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 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.