53 u32 dev_instance = va_arg (*args,
u32);
54 return format (s,
"ipsec%d", dev_instance);
78 .fp_len = (ipsec_sa_is_set_IS_TUNNEL_V6(sa) ? 128 : 32),
79 .fp_proto = (ipsec_sa_is_set_IS_TUNNEL_V6(sa)?
152 ip46_address_t *
src, ip46_address_t *
dst,
u8 * is_l2)
195 .name =
"IPSEC Tunnel",
218 #define IPSEC_ITF_MAX_INSTANCE (16 * 1024) 290 *sw_if_indexp = (
u32) ~ 0;
298 return VNET_API_ERROR_INVALID_REGISTRATION;
300 pool_get (ipsec_itf_pool, ipsec_itf);
309 ipsec_itf_device_class.index,
311 (mode == TUNNEL_MODE_P2P ?
312 ipsec_hw_interface_class.index :
313 ipsec_p2mp_hw_interface_class.index),
333 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
337 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
341 if (NULL == ipsec_itf)
342 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
345 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
348 pool_put (ipsec_itf_pool, ipsec_itf);
364 instance = sw_if_index = ~0;
371 if (
unformat (line_input,
"instance %d", &instance))
408 .path =
"ipsec itf create",
409 .short_help =
"ipsec itf create [instance <instance>]",
434 if (~0 != sw_if_index)
459 .path =
"ipsec itf delete",
460 .short_help =
"ipsec itf delete <interface>",
487 .path =
"show ipsec interface",
489 .short_help =
"show ipsec interface",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
ipsec_itf_t * ipsec_itf_get(index_t ii)
static u8 * format_ipsec_itf_name(u8 *s, va_list *args)
#define pool_foreach_index(i, v)
vl_api_wireguard_peer_flags_t flags
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
static clib_error_t * ipsec_itf_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
void adj_midchain_delegate_stack(adj_index_t ai, u32 fib_index, const fib_prefix_t *pfx)
create/attach a midchain delegate and stack it on the prefix passed
static int ipsec_itf_instance_free(u32 instance)
a non-broadcast multiple access interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
void ipsec_tun_protect_walk_itf(u32 sw_if_index, ipsec_tun_protect_walk_cb_t fn, void *ctx)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
unformat_function_t unformat_vnet_sw_interface
static adj_walk_rc_t ipsec_itf_adj_stack_cb(adj_index_t ai, void *arg)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static clib_error_t * ipsec_itf_delete_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
format_function_t format_vnet_sw_if_index_name
static void ipsec_itf_restack(index_t itpi, const ipsec_itf_t *itf)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static_always_inline void mac_address_set_zero(mac_address_t *mac)
enum walk_rc_t_ walk_rc_t
Walk return code.
VNET_DEVICE_CLASS(ipsec_itf_device_class)
static void ip46_address_reset(ip46_address_t *ip46)
void ipsec_itf_adj_unstack(adj_index_t ai)
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
description fragment has unexpected format
vnet_hw_interface_flags_t flags
Aggregate type for a prefix.
#define clib_error_return(e, args...)
static ipsec_itf_t * ipsec_itf_pool
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u32 adj_get_sw_if_index(adj_index_t ai)
Return the sw interface index of the adjacency.
static ipsec_itf_t * ipsec_itf_find_by_sw_if_index(u32 sw_if_index)
#define pool_put(P, E)
Free an object E in pool P.
static ipsec_sa_t * ipsec_sa_get(u32 sa_index)
vl_api_tunnel_mode_t mode
ip46_address_t tunnel_dst_addr
A dedicated IPSec interface type.
VNET_HW_INTERFACE_CLASS(ipsec_hw_interface_class)
void ipsec_itf_adj_stack(adj_index_t ai, u32 sai)
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
static u32 * ipsec_itf_index_by_sw_if_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
#define IPSEC_ITF_MAX_INSTANCE
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
#define VLIB_CLI_COMMAND(x,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static int ipsec_itf_tunnel_desc(u32 sw_if_index, ip46_address_t *src, ip46_address_t *dst, u8 *is_l2)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static ipsec_tun_protect_t * ipsec_tun_protect_get(u32 index)
int ipsec_itf_delete(u32 sw_if_index)
void ipsec_itf_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
static uword * ipsec_itf_instances
static walk_rc_t ipsec_tun_protect_walk_state_change(index_t itpi, void *arg)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vnet_sw_interface_t * sw_interfaces
a point 2 point interface
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
static clib_error_t * ipsec_itf_create_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int ipsec_itf_create(u32 user_instance, tunnel_mode_t mode, u32 *sw_if_indexp)
static u8 * ipsec_itf_build_rewrite_i(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
static u8 * ipsec_itf_build_rewrite(void)
enum tunnel_mode_t_ tunnel_mode_t
vl_api_interface_index_t sw_if_index
static clib_error_t * ipsec_interface_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u32 ipsec_itf_instance_alloc(u32 want)