49 return VNET_API_ERROR_INSTANCE_IN_USE;
53 return VNET_API_ERROR_NO_SUCH_FIB;
84 u32 fib_index, src_fib_index;
90 return VNET_API_ERROR_NO_SUCH_FIB;
94 if (~0 == src_fib_index)
95 return (VNET_API_ERROR_NO_SUCH_FIB);
110 return VNET_API_ERROR_NO_SUCH_FIB;
128 return VNET_API_ERROR_NO_SUCH_FIB;
146 "svs-ip6"), sw_if_index, 1, NULL, 0);
164 if (~0 != svs_fib_index)
205 return VNET_API_ERROR_NO_SUCH_FIB;
208 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
217 "svs-ip6"), sw_if_index, 0, NULL, 0);
263 u32 n_left_from, *from, *to_next, next_index;
269 while (n_left_from > 0)
275 while (n_left_from > 0 && n_left_to_next > 0)
279 u32 bi0, sw_if_index0;
331 to_next, n_left_to_next, bi0,
371 .vector_size =
sizeof (
u32),
385 .vector_size =
sizeof (
u32),
396 .arc_name =
"ip4-unicast",
397 .node_name =
"svs-ip4",
402 .arc_name =
"ip6-unicast",
403 .node_name =
"svs-ip6",
429 else if (
unformat (input,
"table-id %d", &table_id))
449 .short_help =
"Source VRF select table [add|delete] [ip4|ip6] table-id X",
464 sw_if_index = table_id = ~0;
473 else if (
unformat (input,
"enable"))
475 else if (
unformat (input,
"disable"))
481 else if (
unformat (input,
"table-id %d", &table_id))
487 if (~0 == sw_if_index)
502 .path =
"svs enable",
503 .short_help =
"Source VRF select [enable|disable] [ip4|ip6] <table-id> X <interface>",
517 src_table_id = table_id = ~0;
526 else if (
unformat (input,
"table-id %d", &table_id))
528 else if (
unformat (input,
"src-table-id %d", &src_table_id))
546 if (~0 == src_table_id)
565 .short_help =
"Source VRF select route [add|delete] <table-id> <prefix> <src-table-id>",
577 vlib_cli_output (vm,
"Source VRF select interface to fib-index mappings:");
594 .short_help =
"Source VRF select show",
void dpo_unlock(dpo_id_t *dpo)
Release a reference counting lock on the DPO.
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 fp_proto
protocol type
enum fib_source_t_ fib_source_t
The different sources that can create a route.
#define vec_foreach_index(var, v)
Iterate over vector indices.
A representation of an MPLS label for imposition in the data-path.
ip4_table_bind_function_t * function
static u32 ip6_fib_table_fwding_lookup(u32 fib_index, const ip6_address_t *dst)
static uword svs_input_ip4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
VNET_FEATURE_INIT(svs_ip4_feat, static)
vnet_main_t * vnet_get_main(void)
int svs_route_delete(u32 table_id, const fib_prefix_t *pfx)
static clib_error_t * svs_table_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static const dpo_id_t * load_balance_get_fwd_bucket(const load_balance_t *lb, u16 bucket)
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
add paths without path extensions
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 svs_disable(fib_protocol_t fproto, u32 table_id, u32 sw_if_index)
static void svs_ip6_table_bind(ip6_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
unformat_function_t unformat_vnet_sw_interface
static u8 * format_svs_input_trace(u8 *s, va_list *args)
format_function_t format_vnet_sw_if_index_name
u8 * format_fib_protocol(u8 *s, va_list *ap)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static uword svs_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * svs_enable_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
Aggregate type for a prefix.
#define clib_error_return(e, args...)
static void svs_table_bind(fib_protocol_t fproto, u32 sw_if_index, u32 itf_fib_index)
enum svs_next_t_ svs_next_t
static fib_source_t svs_fib_src
int svs_enable(fib_protocol_t fproto, u32 table_id, u32 sw_if_index)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
vl_api_fib_path_type_t type
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static lookup_dpo_t * lookup_dpo_get(index_t index)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
int svs_table_delete(fib_protocol_t fproto, u32 table_id)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static int svs_route_add_i(u32 fib_index, const fib_prefix_t *pfx, u32 src_fib_index)
ip6_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
static u8 * format_vnet_api_errno(u8 *s, va_list *args)
#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).
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
static clib_error_t * svs_show_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void svs_ip4_table_bind(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
walk_rc_t(* svs_walk_fn_t)(fib_protocol_t fproto, u32 table_id, u32 sw_if_index, void *ctx)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
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 clib_error_t * svs_init(vlib_main_t *vm)
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u32 * svs_itf_db[FIB_PROTOCOL_IP_MAX]
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword svs_input_ip6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static load_balance_t * load_balance_get(index_t lbi)
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
static index_t ip4_fib_forwarding_lookup(u32 fib_index, const ip4_address_t *addr)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
void svs_walk(svs_walk_fn_t fn, void *ctx)
#define FIB_SOURCE_PRIORITY_LOW
vlib_node_registration_t svs_ip4_node
(constructor) VLIB_REGISTER_NODE (svs_ip4_node)
struct svs_input_trace_t_ svs_input_trace_t
ip4_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
int svs_table_add(fib_protocol_t fproto, u32 table_id)
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
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.
ip6_table_bind_function_t * function
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
int svs_route_add(u32 table_id, const fib_prefix_t *pfx, u32 source_table_id)
ip4_main_t ip4_main
Global ip4 main structure.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
vlib_node_registration_t svs_ip6_node
(constructor) VLIB_REGISTER_NODE (svs_ip6_node)
#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 clib_error_t * svs_route_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
fib_node_index_t lkd_fib_index
The FIB, or interface from which to get a FIB, in which to perform the next lookup;.
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)