43 return (
l3xc_db[fproto][sw_if_index]);
129 1, &l3xci, sizeof (l3xci));
171 return (VNET_API_ERROR_INVALID_VALUE);
184 0, &l3xci, sizeof (l3xci));
219 else if (
unformat (line_input,
"ip6"))
221 else if (
unformat (line_input,
"ip4"))
223 else if (
unformat (line_input,
"del"))
225 else if (
unformat (line_input,
"add"))
227 else if (
unformat (line_input,
"via %U",
235 if (~0 == sw_if_index)
273 .short_help =
"l3xc [add|del] <INTERFACE> via ...",
284 s =
format (s,
"l3xc:[%d]: %U",
290 s =
format (s,
"no forwarding");
336 .short_help =
"show l3xc",
351 return ((
l3xc_t *) (((
char *) node) -
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.
Contribute an object that is to be used to forward IP6 packets.
static clib_error_t * l3xc_show_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
A representation of a path as described by a route producer.
int(* l3xc_walk_cb_t)(index_t l3xci, void *ctx)
Callback function invoked during a walk of all policies.
vnet_main_t * vnet_get_main(void)
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.
fib_node_type_t l3xc_fib_node_type
FIB node type the attachment is registered.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
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).
int l3xc_delete(u32 sw_if_index, u8 is_ip6)
Delete an L3XC.
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
static fib_node_t * l3xc_get_node(fib_node_index_t index)
static l3xc_t * l3xc_get_from_node(fib_node_t *node)
dpo_id_t l3xc_dpo
DPO for forwarding.
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)
format_function_t format_vnet_sw_if_index_name
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.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vlib_node_registration_t l3xc_ip4_node
(constructor) VLIB_REGISTER_NODE (l3xc_ip4_node)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static_always_inline l3xc_t * l3xc_get(u32 index)
int l3xc_update(u32 sw_if_index, u8 is_ip6, const fib_route_path_t *rpaths)
Create or update an L3XC Policy.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static fib_node_back_walk_rc_t l3xc_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
u32 l3xc_sw_if_index
The input interface.
static clib_error_t * l3xc_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
#define pool_put(P, E)
Free an object E in pool P.
static u8 * format_l3xc(u8 *s, va_list *args)
#define pool_get_aligned_zero(P, E, A)
Allocate an object E from a pool P with alignment A and zero it.
An node in the FIB graph.
static void l3xc_db_remove(u32 sw_if_index, fib_protocol_t fproto)
static void l3xc_db_add(u32 sw_if_index, fib_protocol_t fproto, index_t l3xci)
u32 fib_node_index_t
A typedef of a node index.
static void l3xc_stack(l3xc_t *l3xc)
vlib_node_registration_t l3xc_ip6_node
(constructor) VLIB_REGISTER_NODE (l3xc_ip6_node)
vlib_main_t vlib_node_runtime_t * node
void l3xc_walk(l3xc_walk_cb_t cb, void *ctx)
Walk/visit each of the L3XC policies.
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
static u32 * l3xc_db[FIB_PROTOCOL_IP_MAX]
DB of L3XC objects.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
index_t l3xc_find(u32 sw_if_index, fib_protocol_t fproto)
Find a L3 XC object from an interface and FIB protocol.
l3xc_t * l3xc_pool
Pool of L3XC objects.
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
u32 l3xc_sibling
Sibling index on the path-list.
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void l3xc_last_lock_gone(fib_node_t *node)
#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)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
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)
A FIB graph nodes virtual function table.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#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)
#define CLIB_CACHE_LINE_BYTES
fib_node_index_t l3xc_pl
The path-list describing how to forward in case of a match.
fib_node_t l3xc_node
Linkage into the FIB graph.
static clib_error_t * l3xc_init(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
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)
typedef l3xc
A description of an L3XC policy.
fib_protocol_t l3xc_proto