184 return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
189 pool_get (abf_itf_attach_pool, aia);
222 sw_if_index, 1,
NULL, 0);
261 return (VNET_API_ERROR_NO_SUCH_ENTRY);
270 aia - abf_itf_attach_pool);
287 sw_if_index, 0,
NULL, 0);
322 pool_put (abf_itf_attach_pool, aia);
334 s =
format (s,
"abf-interface-attach: policy:%d priority:%d",
351 sw_if_index = policy_id = ~0;
366 else if (
unformat (input,
"policy %d", &policy_id))
368 else if (
unformat (input,
"priority %d", &priority))
382 if (~0 == sw_if_index)
407 .path =
"abf attach",
409 .short_help =
"abf attach <ip4|ip6> [del] policy <value> <interface>",
436 if (~0 == sw_if_index)
462 .path =
"show abf attach",
464 .short_help =
"show abf attach <interface>",
497 #define abf_error(n,s) ABF_ERROR_##n, 508 u32 n_left_from, *from, *to_next, next_index, matches;
515 while (n_left_from > 0)
521 while (n_left_from > 0 && n_left_to_next > 0)
523 const u32 *attachments0;
527 u32 bi0, sw_if_index0;
529 u32 match_acl_index = ~0;
530 u32 match_acl_pos = ~0;
531 u32 match_rule_index = ~0;
532 u32 trace_bitmap = 0;
570 (acl_plugin.
p_acl_main, lc_index, &fa_5tuple0,
572 &match_acl_index, &match_rule_index, &trace_bitmap))
605 to_next, n_left_to_next, bi0,
616 ABF_ERROR_MATCHED, matches);
647 #define abf_error(n,s) s, 656 .name =
"abf-input-ip4",
657 .vector_size =
sizeof (
u32),
660 .n_errors = ABF_N_ERROR,
672 .name =
"abf-input-ip6",
673 .vector_size =
sizeof (
u32),
687 .arc_name =
"ip4-unicast",
688 .node_name =
"abf-input-ip4",
694 .arc_name =
"ip6-unicast",
695 .node_name =
"abf-input-ip6",
759 return (acl_init_res);
762 acl_plugin.register_user_module (
"ABF plugin",
"sw_if_index",
NULL);
import vnet fib fib_types api
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
fib_protocol_t aia_proto
The protocol for the attachment.
Contribute an object that is to be used to forward IP6 packets.
#define hash_set(h, key, value)
vlib_node_registration_t abf_ip6_node
(constructor) VLIB_REGISTER_NODE (abf_ip6_node)
#define hash_unset(h, key)
vnet_main_t * vnet_get_main(void)
u32 ap_id
The policy ID - as configured by the client.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
abf_policy_t * abf_policy_get(u32 index)
Get an ABF object from its VPP index.
static u32 abf_acl_user_id
ABF ACL module user id returned during the initialization.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
int abf_itf_detach(fib_protocol_t fproto, u32 policy_id, u32 sw_if_index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static clib_error_t * abf_itf_bond_init(vlib_main_t *vm)
Contribute an object that is to be used to forward IP4 packets.
#define STRUCT_OFFSET_OF(t, f)
unformat_function_t unformat_vnet_sw_interface
fib_node_type_t abf_policy_fib_node_type
FIB node type the attachment is registered.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static u32 * abf_alctx_per_itf[FIB_PROTOCOL_MAX]
Per interface values of ACL lookup context IDs.
static uword * abf_itf_attach_db
A DB of attachments; key={abf_index,sw_if_index}.
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
static acl_plugin_methods_t acl_plugin
u8 * format_fib_protocol(u8 *s, va_list *ap)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 aia_acl
The ACL and DPO are cached for fast DP access.
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
void abf_setup_acl_lc(fib_protocol_t fproto, u32 sw_if_index)
static abf_itf_attach_t * abf_itf_attach_db_find(u32 abf_index, u32 sw_if_index)
u32 aia_abf
The VPP index of the ABF policy.
static char * abf_error_strings[]
#define VLIB_INIT_FUNCTION(x)
static abf_itf_attach_t * abf_itf_attach_get(u32 index)
static fib_node_back_walk_rc_t abf_itf_attach_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
#define clib_error_return(e, args...)
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
static void abf_itf_attach_stack(abf_itf_attach_t *aia)
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
u32 abf_policy_find(u32 policy_id)
Find a ABF object from the client's policy ID.
static clib_error_t * abf_itf_attach_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
u32 aia_sibling
Sibling index on the policy's path list.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_abf_intf_attach(u8 *s, va_list *args)
u32 aia_sw_if_index
The interface for the attachment.
#define pool_put(P, E)
Free an object E in pool P.
#define vec_del1(v, i)
Delete the element at index I.
struct abf_input_trace_t_ abf_input_trace_t
#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.
An node in the FIB 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).
int(* abf_itf_attach_walk_cb_t)(index_t aii, void *ctx0)
static u64 abf_itf_attach_mk_key(u32 abf_index, u32 sw_if_index)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
fib_node_index_t ap_pl
The path-list describing how to forward in case of a match.
#define VLIB_REGISTER_NODE(x,...)
static u8 * format_abf_input_trace(u8 *s, va_list *args)
Attachment data for an ABF policy to an interface.
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
u32 fib_node_index_t
A typedef of a node index.
static clib_error_t * acl_plugin_exports_init(acl_plugin_methods_t *m)
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.
static u32 ** abf_per_itf[FIB_PROTOCOL_MAX]
A per interface vector of attached policies.
static int abf_cmp_attach_for_sort(void *v1, void *v2)
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static fib_node_t * abf_itf_attach_get_node(fib_node_index_t index)
u32 aia_prio
The priority of this policy for attachment.
An ACL based Forwarding 'policy'.
static uword abf_input_ip6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static fib_node_type_t abf_itf_attach_fib_node_type
FIB node registered type for the bonds.
static int acl_plugin_match_5tuple_inline(void *p_acl_main, u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
void abf_itf_attach_walk(abf_itf_attach_walk_cb_t cb, void *ctx)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
int abf_itf_attach(fib_protocol_t fproto, u32 policy_id, u32 priority, u32 sw_if_index)
static abf_itf_attach_t * abf_itf_attach_get_from_node(fib_node_t *node)
static uword abf_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
#define VNET_FEATURES(...)
enum abf_next_t_ abf_next_t
u32 ap_acl
ACL index to match.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
dpo_id_t aia_dpo
The DPO actually used for forwarding.
struct _vlib_node_registration vlib_node_registration_t
static void abf_itf_attach_db_add(u32 abf_index, u32 sw_if_index, abf_itf_attach_t *aia)
index_t dpoi_index
the index of objects of that type
static void abf_itf_attach_db_del(u32 abf_index, u32 sw_if_index)
#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...
VLIB buffer representation.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
A FIB graph nodes virtual function table.
VNET_FEATURE_INIT(abf_ip4_feat, static)
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
vlib_node_registration_t abf_ip4_node
Forward declarations;.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
static clib_error_t * abf_show_attach_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword abf_input_ip4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void abf_itf_attach_last_lock_gone(fib_node_t *node)
u16 dpoi_next_node
The next VLIB node to follow.
abf_itf_attach_t * abf_itf_attach_pool
Pool of ABF interface attachment objects.
#define pool_foreach_index(i, v, body)
Iterate pool by index.
#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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
fib_node_t aia_node
Linkage into the FIB graph.
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)