|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
77 key.l3.prefix.as_u64[0] =
prefix->as_u64[0];
78 key.l3.prefix.as_u64[1] =
prefix->as_u64[1];
99 key.traffic_type = traffic_type;
139 "sr-pl-rewrite-encaps-l2",
254 sizeof (ip46_address_t));
281 goto cleanup_error_encap;
284 (
"device-input",
"sr-pl-rewrite-encaps-l2",
sw_if_index, 1, 0, 0))
285 goto cleanup_error_redirection;
297 goto cleanup_error_encap;
314 (ip46_address_t *) & sr_policy->
bsid, ~0,
331 (ip46_address_t *) & sr_policy->
bsid, ~0,
355 cleanup_error_redirection:
370 u32 dst_mask_width = 0;
373 u32 fib_table = (
u32) ~ 0;
376 u32 sr_policy_index = (
u32) ~ 0;
378 u8 sr_policy_set = 0;
387 else if (!traffic_type
389 &
prefix.ip6, &dst_mask_width))
391 else if (!traffic_type
393 &
prefix.ip4, &dst_mask_width))
395 else if (!traffic_type
399 else if (!sr_policy_set
400 &&
unformat (input,
"via index %d", &sr_policy_index))
402 else if (!sr_policy_set
406 else if (fib_table == (
u32) ~ 0
407 &&
unformat (input,
"fib-table %d", &fib_table));
414 if (!is_del && !sr_policy_set)
421 (dst_mask_width ? (0xFFFFFFFFu >> (32 - dst_mask_width)) : 0);
433 sr_policy_index, fib_table, &
prefix, dst_mask_width,
446 "The requested SR policy could not be located. Review the BSID/index.");
449 "Unable to do SW redirect. Incorrect interface.");
452 "The requested SR steering policy could not be deleted.");
455 "The SR policy is not an encapsulation one.");
465 .short_help =
"sr steer (del) [l3 <ip_addr/mask>|l2 <sf_if>] "
466 "via [index <sr_policy_index>|bsid <bsid_ip6_addr>] "
467 "(fib-table <fib_table_index>)",
469 "\tSteer a L2 or L3 traffic through an existing SR policy.\n"
471 "\t\tsr steer l3 2001::/64 via sr_policy index 5\n"
472 "\t\tsr steer l3 2001::/64 via sr_policy bsid 2010::9999:1\n"
473 "\t\tsr steer l2 GigabitEthernet0/5/0 via sr_policy index 5\n"
474 "\t\tsr steer del l3 2001::/64 via sr_policy index 5\n",
498 for (
i = 0;
i <
vec_len (steer_policies);
i++)
500 steer_pl = steer_policies[
i];
531 .path =
"show sr steering-policies",
532 .short_help =
"show sr steering-policies",
560 .arc_name =
"device-input",
561 .node_name =
"sr-pl-rewrite-encaps-l2",
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Add one path to an entry (aka route) in the FIB.
u8 is_encap
Mode (0 is SRH insert, 1 Encaps)
vnet_sw_interface_type_t type
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * sr_steer_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
#define clib_error_return(e, args...)
ip6_sr_steering_policy_t * steer_policies
struct sr_steering_key_t::@547::@550 l2
u16 fp_len
The mask length.
#define pool_put(P, E)
Free an object E in pool P.
static uword * mhash_get(mhash_t *h, const void *key)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u32 * sw_iface_sr_policies
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static vlib_cli_command_t sr_steer_policy_command
(constructor) VLIB_CLI_COMMAND (sr_steer_policy_command)
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
VNET_FEATURE_INIT(sr_pl_rewrite_encaps_l2, static)
sr_steering_key_t classify
Traffic classification.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
@ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
Segment Routing data structures definitions.
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
u8 traffic_type
Traffic type (IPv4, IPv6, L2)
vnet_main_t * vnet_get_main(void)
static clib_error_t * show_sr_steering_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 sr_policy
SR Policy index.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define VLIB_CLI_COMMAND(x,...)
@ FIB_SOURCE_SR
SRv6 and SR-MPLS.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vnet_sw_interface_t * sw_interfaces
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static void ip6_address_mask(ip6_address_t *a, const ip6_address_t *mask)
Segment Routing main datastructure.
#define pool_len(p)
Number of elements in pool vector.
ip6_address_t bsid
BindingSID (key)
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
@ FIB_ROUTE_PATH_FLAG_NONE
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static uword pool_elts(void *v)
Number of active elements in a pool.
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
fib_protocol_t fp_proto
protocol type
static vlib_cli_command_t show_sr_steering_policies_command
(constructor) VLIB_CLI_COMMAND (show_sr_steering_policies_command)
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)
mhash_t sr_steer_policies_hash
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define VNET_FEATURES(...)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
clib_error_t * sr_steering_init(vlib_main_t *vm)
ip6_sr_policy_t * sr_policies
int sr_steering_policy(int is_del, ip6_address_t *bsid, u32 sr_policy_index, u32 table_id, ip46_address_t *prefix, u32 mask_width, u32 sw_if_index, u8 traffic_type)
Steer traffic L2 and L3 traffic through a given SR policy.
@ VNET_SW_INTERFACE_TYPE_HARDWARE
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
struct sr_steering_key_t::@547::@549 l3
mhash_t sr_policies_index_hash
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
Aggregate type for a prefix.
vnet_interface_main_t interface_main
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)