24 #include <vpp/app/version.h> 27 #define SID_CREATE_IFACE_FEATURE_ERROR -1 28 #define SID_CREATE_INVALID_IFACE_TYPE -3 29 #define SID_CREATE_INVALID_IFACE_INDEX -4 30 #define SID_CREATE_INVALID_ADJ_INDEX -5 35 "Endpoint with dynamic proxy to SR-unaware appliance";
36 unsigned char params_str[] =
"nh <next-hop> oif <iface-out> iif <iface-in>";
71 ls_mem->
nh_adj = nh_adj_index;
287 s =
format (s,
"\tGood rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
289 s =
format (s,
"\tBad rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
305 void **plugin_mem_p = va_arg (*args,
void **);
316 #define PARAM_AD_NH (1 << 0) 317 #define PARAM_AD_OIF (1 << 1) 318 #define PARAM_AD_IIF (1 << 2) 332 if (!(params & PARAM_AD_NH) &&
unformat (input,
"nh %U",
341 vnm, &sw_if_index_out))
347 vnm, &sw_if_index_in))
359 if ((params & params_chk) != params_chk)
367 *plugin_mem_p = ls_mem;
372 ls_mem->
nh_addr.ip4 = nh_addr.ip4;
374 ls_mem->
nh_addr.ip6 = nh_addr.ip6;
389 return (
format (s,
"SR: dynamic_proxy_index:[%u]", index));
453 .arc_name =
"device-input",
454 .node_name =
"srv6-ad2-rewrite",
460 .arc_name =
"ip4-unicast",
461 .node_name =
"srv6-ad4-rewrite",
467 .arc_name =
"ip6-unicast",
468 .node_name =
"srv6-ad6-rewrite",
475 .version = VPP_BUILD_VER,
476 .description =
"Dynamic Segment Routing for IPv6 (SRv6) Proxy",
dpo_lock_fn_t dv_lock
A reference counting lock function.
u8 * format_srv6_ad_localsid(u8 *s, va_list *args)
vnet_main_t * vnet_main
[convenience] vnet main
A virtual function table regisitered for a DPO type.
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
static int srv6_ad_localsid_creation_fn(ip6_sr_localsid_t *localsid)
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static const char *const *const srv6_ad_nodes[DPO_PROTO_NUM]
vnet_interface_main_t interface_main
static int srv6_ad_localsid_removal_fn(ip6_sr_localsid_t *localsid)
uword unformat_srv6_ad_localsid(unformat_input_t *input, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define SID_CREATE_INVALID_IFACE_INDEX
static clib_error_t * srv6_ad_init(vlib_main_t *vm)
u32 * sw_iface_localsid4
Retrieve local SID from iface.
void srv6_ad_dpo_unlock(dpo_id_t *dpo)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Combined counter to hold both packets and byte differences.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
format_function_t format_vnet_sw_if_index_name
int sr_localsid_register_function(vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_plugin_callback_t *creation_fn, sr_plugin_callback_t *removal_fn)
SR LocalSID plugin registry.
#define pool_len(p)
Number of elements in pool vector.
#define SID_CREATE_IFACE_FEATURE_ERROR
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
#define VLIB_INIT_FUNCTION(x)
vlib_combined_counter_main_t invalid_counters
Invalid rewrite counters.
void srv6_ad_dpo_lock(dpo_id_t *dpo)
description fragment has unexpected format
#define clib_error_return(e, args...)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
u32 nh_adj
Adjacency index for out.
ip46_address_t nh_addr
Proxied device address.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
counter_t packets
packet counter
u32 sw_if_index_out
Outgoing iface to proxied dev.
#define SID_CREATE_INVALID_IFACE_TYPE
#define pool_put(P, E)
Free an object E in pool P.
u32 rw_len
Number of bits to be rewritten.
static u8 * format_srv6_ad_dpo(u8 *s, va_list *args)
vlib_main_t * vlib_main
[convenience] vlib main
u8 * rewrite
Headers to be rewritten.
srv6_ad_localsid_t ** sids
Pool of AD SID pointers.
ip6_sr_localsid_t * localsids
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define vec_free(V)
Free vector's memory (no header).
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
static const char *const srv6_ad_ip6_nodes[]
void * plugin_mem
Memory to be used by the plugin callback functions.
#define SID_CREATE_INVALID_ADJ_INDEX
static void clib_mem_free(void *p)
dpo_type_t srv6_ad_dpo_type
DPO type.
#define VNET_FEATURES(...)
unsigned char function_name[]
u32 * sw_iface_localsid2
Retrieve local SID from iface.
srv6_ad_main_t srv6_ad_main
counter_t bytes
byte counter
vlib_combined_counter_main_t valid_counters
Valid rewrite counters.
u32 * sw_iface_localsid6
Retrieve local SID from iface.
u32 sw_if_index_in
Incoming iface from proxied dev.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char params_str[]
VNET_FEATURE_INIT(srv6_ad2_rewrite, static)
vnet_sw_interface_t * sw_interfaces
unsigned char keyword_str[]
Segment Routing main datastructure.
vnet_sw_interface_type_t type
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
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)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)