49 return (abf - abf_policy_pool);
98 ap->
ap_id = policy_id;
131 if (ap->
ap_acl != acl_index)
134 return (VNET_API_ERROR_INVALID_VALUE);
193 return (VNET_API_ERROR_INVALID_VALUE);
263 if (
unformat (line_input,
"acl %d", &acl_index))
265 else if (
unformat (line_input,
"id %d", &policy_id))
267 else if (
unformat (line_input,
"del"))
269 else if (
unformat (line_input,
"add"))
271 else if (
unformat (line_input,
"via %U",
295 if (rv == VNET_API_ERROR_INVALID_VALUE)
298 "ACL index must match existing ACL index in policy");
316 .path =
"abf policy",
318 .short_help =
"abf policy [add|del] id <index> acl <index> via ...",
328 s =
format (s,
"abf:[%d]: policy:%d acl:%d",
333 s =
format (s,
"no forwarding");
368 if (
unformat (input,
"%d", &policy_id))
399 .path =
"show abf policy",
401 .short_help =
"show abf policy <value>",
static abf_policy_t * abf_policy_get_from_node(fib_node_t *node)
static abf_policy_t * abf_policy_find_i(u32 policy_id)
static u32 abf_policy_get_index(const abf_policy_t *abf)
#define hash_set(h, key, value)
static uword * abf_policy_db
DB of ABF policy objects.
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
#define hash_unset(h, key)
static fib_node_back_walk_rc_t abf_policy_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
A representation of a path as described by a route producer.
u32 ap_id
The policy ID - as configured by the client.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
uword unformat_fib_route_path(unformat_input_t *input, va_list *args)
Unformat a fib_route_path_t from CLI input.
abf_policy_t * abf_policy_get(u32 index)
Get an ABF object from its VPP index.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define STRUCT_OFFSET_OF(t, f)
static fib_node_t * abf_policy_get_node(fib_node_index_t index)
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).
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_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.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * abf_policy_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
u32 ap_sibling
Sibling index on the path-list.
#define clib_error_return(e, args...)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static u8 * format_abf(u8 *s, va_list *args)
u32 abf_policy_find(u32 policy_id)
Find a ABF object from the client's policy ID.
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
static void abf_policy_destroy(abf_policy_t *ap)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
int abf_policy_update(u32 policy_id, u32 acl_index, const fib_route_path_t *rpaths)
Create or update an ABF Policy.
void fib_node_lock(fib_node_t *node)
int(* abf_policy_walk_cb_t)(index_t index, void *ctx)
Callback function invoked during a walk of all policies.
#define pool_put(P, E)
Free an object E in pool P.
void fib_path_list_lock(fib_node_index_t path_list_index)
void abf_policy_walk(abf_policy_walk_cb_t cb, void *ctx)
Walk/visit each of the ABF policies.
An node in the FIB graph.
void fib_node_unlock(fib_node_t *node)
static void abf_policy_last_lock_gone(fib_node_t *node)
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
fib_node_index_t ap_pl
The path-list describing how to forward in case of a match.
u32 fib_node_index_t
A typedef of a node index.
void fib_path_list_unlock(fib_node_index_t path_list_index)
vlib_main_t vlib_node_runtime_t * node
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
An ACL based Forwarding 'policy'.
import vnet interface_types api
u32 ap_acl
ACL index to match.
static clib_error_t * abf_policy_init(vlib_main_t *vm)
#define FIB_NODE_INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
A FIB graph nodes virtual function table.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
int abf_policy_delete(u32 policy_id, const fib_route_path_t *rpaths)
Delete paths from an ABF Policy.
fib_node_t ap_node
Linkage into the FIB graph.
static clib_error_t * abf_show_policy_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach_index(i, v, body)
Iterate pool by index.
static abf_policy_t * abf_policy_pool
Pool of ABF objects.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)