|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
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 static proxy to SR-unaware appliance";
37 "nh <next-hop> oif <iface-out> iif <iface-in> src <src-addr> next <sid> [next <sid> ...]";
45 u8 *rewrite_str = NULL;
55 rewrite_len += sr_hdr_len;
63 clib_host_to_net_u32 (0 | ((6 & 0xF) << 28));
72 iph->
protocol = IP_PROTOCOL_IPV6_ROUTE;
77 srh->
length = sr_hdr_len / 8 - 1;
85 ip6_address_t *this_address;
89 *addrp = *this_address;
142 ls_mem->
nh_adj = nh_adj_index;
215 IP_PROTOCOL_IP_IN_IP);
366 s =
format (s,
"\tSegment list:\t< ");
372 s =
format (s,
"\b\b >\n");
379 format (s,
"\tGood rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
382 format (s,
"\tBad rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
398 void **plugin_mem_p = va_arg (*args,
void **);
408 ip6_address_t next_sid;
409 ip6_address_t *sid_list = NULL;
412 #define PARAM_AS_NH (1 << 0)
413 #define PARAM_AS_OIF (1 << 1)
414 #define PARAM_AS_IIF (1 << 2)
415 #define PARAM_AS_SRC (1 << 3)
438 vnm, &sw_if_index_out))
444 vnm, &sw_if_index_in))
466 if ((params & params_chk) != params_chk || sid_list == NULL)
475 *plugin_mem_p = ls_mem;
499 return (
format (s,
"SR: static_proxy_index:[%u]",
index));
563 .arc_name =
"device-input",
564 .node_name =
"srv6-as2-rewrite",
570 .arc_name =
"ip4-unicast",
571 .node_name =
"srv6-as4-rewrite",
577 .arc_name =
"ip6-unicast",
578 .node_name =
"srv6-as6-rewrite",
585 .version = VPP_BUILD_VER,
586 .description =
"Static Segment Routing for IPv6 (SRv6) Proxy",
u32 * sw_iface_localsid6
Retrieve local SID from iface.
static clib_error_t * srv6_as_init(vlib_main_t *vm)
ip46_address_t nh_addr
Proxied device address.
vlib_main_t * vlib_main
[convenience] vlib main
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
u8 * format_srv6_as_localsid(u8 *s, va_list *args)
vnet_sw_interface_type_t type
unsigned char keyword_str[]
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.
unsigned char params_str[]
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
vlib_combined_counter_main_t invalid_counters
Invalid rewrite counters.
#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.
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.
static void clib_mem_free(void *p)
void * plugin_mem
Memory to be used by the plugin callback functions.
#define clib_error_return(e, args...)
ip6_address_t * sid_list
SID list to be restored.
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
u32 * sw_iface_localsid4
Retrieve local SID from iface.
#define SID_CREATE_INVALID_IFACE_TYPE
#define SID_CREATE_INVALID_IFACE_INDEX
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define IP_PROTOCOL_IP6_ETHERNET
unsigned char function_name[]
u8 * rewrite
Headers to be rewritten.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define SID_CREATE_INVALID_ADJ_INDEX
#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).
static int srv6_as_localsid_removal_fn(ip6_sr_localsid_t *localsid)
vnet_main_t * vnet_get_main(void)
#define SID_CREATE_IFACE_FEATURE_ERROR
Combined counter to hold both packets and byte differences.
vl_api_mac_address_t src_addr
vlib_combined_counter_main_t valid_counters
Valid rewrite counters.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
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.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static int srv6_as_localsid_creation_fn(ip6_sr_localsid_t *localsid)
u32 sw_if_index_out
Outgoing iface to proxied dev.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
dpo_lock_fn_t dv_lock
A reference counting lock function.
counter_t packets
packet counter
ip6_address_t src_addr
Source address to be restored.
vnet_sw_interface_t * sw_interfaces
u32 nh_adj
Adjacency index for out.
void srv6_as_dpo_lock(dpo_id_t *dpo)
ip6_sr_localsid_t * localsids
static u8 * format_srv6_as_dpo(u8 *s, va_list *args)
#define IPv6_DEFAULT_HEADER_LENGTH
const static char *const *const srv6_as_nodes[DPO_PROTO_NUM]
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...
static u8 * prepare_rewrite(ip6_address_t src_addr, ip6_address_t *sid_list, u8 protocol)
Segment Routing main datastructure.
VNET_FEATURE_INIT(srv6_as2_rewrite, static)
#define vec_free(V)
Free vector's memory (no header).
#define pool_len(p)
Number of elements in pool vector.
const static char *const srv6_as_ip6_nodes[]
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
srv6_as_main_t srv6_as_main
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
void srv6_as_dpo_unlock(dpo_id_t *dpo)
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
counter_t bytes
byte counter
vl_api_ip_proto_t protocol
const static dpo_vft_t srv6_as_vft
srv6_as_localsid_t ** sids
Pool of AS SID pointers.
u32 sw_if_index_in
Incoming iface from proxied dev.
#define vec_foreach(var, vec)
Vector iterator.
#define ROUTING_HEADER_TYPE_SR
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
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 adj_index_t
An index for adjacencies.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
A virtual function table regisitered for a DPO type.
#define VNET_FEATURES(...)
uword unformat_srv6_as_localsid(unformat_input_t *input, va_list *args)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
dpo_type_t srv6_as_dpo_type
DPO type.
u8 sr_get_hop_limit(void)
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
@ VNET_SW_INTERFACE_TYPE_HARDWARE
vnet_main_t * vnet_main
[convenience] vnet main
u32 * sw_iface_localsid2
Retrieve local SID from iface.
vnet_interface_main_t interface_main
static void free_ls_mem(srv6_as_localsid_t *ls_mem)