27 int has_pot_option,
int has_ppc_option,
34 u8 trace_data_size = 0;
37 if (has_trace_option == 0 && has_pot_option == 0)
64 sizeof (ip4_vxlan_gpe_header_t));
72 sizeof (ip6_vxlan_gpe_header_t));
76 vxlan_gpe_ioam_hdr->
type = VXLAN_GPE_PROTOCOL_IOAM;
88 current += trace_data_size;
97 (current, &pot_data_size))
98 current += pot_data_size;
106 int has_pot_option,
int has_ppc_option,
127 int has_trace_option,
int has_pot_option,
128 int has_ppc_option,
u8 ipv6_set)
140 "vxlan_gpe_ioam_clear_rewrite returned %d",
149 int has_trace_option,
int has_pot_option,
150 int has_ppc_option,
u8 ipv6_set)
154 has_pot_option, has_ppc_option, ipv6_set);
163 "vxlan_gpe_ioam_set_rewrite returned %d",
177 sw_if_index0, is_add,
192 vxlan_gpe_set_clear_output_feature_on_intf
193 (vm, si->sw_if_index, 0);
204 ip46_address_t dst_addr,
210 u32 sw_if_index0 = ~0;
269 sw_if_index0 = adj0->rewrite_header.sw_if_index;
271 if (~0 == sw_if_index0)
280 "vxlan-gpe-transit-ioam",
281 sw_if_index0, is_add, 0
321 clib_memcpy (key4_copy, &key4,
sizeof (*key4_copy));
333 .fp_addr = {.ip4 = t1->
dst_addr.ip4,}
354 key4_copy = (
void *) (hp->
key);
382 vxlan_gpe_enable_disable_ioam_for_dest
386 (t->fp_proto == FIB_PROTOCOL_IP4), 1
398 u32 sw_if_index0 = 0;
399 for (sw_if_index0 = 0;
419 ip46_address_t local, remote;
428 vxlan4_gpe_tunnel_key_t key4;
429 vxlan6_gpe_tunnel_key_t key6;
457 else if (
unformat (input,
"vni %d", &vni))
459 else if (
unformat (input,
"disable"))
469 if (ipv4_set && ipv6_set)
472 && memcmp (&local.ip4, &remote.ip4,
473 sizeof (local.ip4)) == 0) || (ipv6_set
478 sizeof (local.ip6)) == 0))
484 key4.local = local.ip4.as_u32;
485 key4.remote = remote.ip4.as_u32;
486 key4.vni = clib_host_to_net_u32 (vni << 8);
492 key6.local.as_u64[0] = local.ip6.as_u64[0];
493 key6.local.as_u64[1] = local.ip6.as_u64[1];
494 key6.remote.as_u64[0] = remote.ip6.as_u64[0];
495 key6.remote.as_u64[1] = remote.ip6.as_u64[1];
496 key6.vni = clib_host_to_net_u32 (vni << 8);
519 .path =
"set vxlan-gpe-ioam",
520 .short_help =
"set vxlan-gpe-ioam vxlan <src-ip> <dst_ip> <vnid> [disable]",
529 int has_pot_option,
int has_ppc_option)
546 int has_pot_option,
int has_ppc_option)
573 int has_trace_option = 0;
574 int has_pot_option = 0;
575 int has_ppc_option = 0;
580 has_trace_option = 1;
583 else if (
unformat (input,
"ppc encap"))
585 else if (
unformat (input,
"ppc decap"))
587 else if (
unformat (input,
"ppc none"))
602 .path =
"set vxlan-gpe-ioam rewrite",
603 .short_help =
"set vxlan-gpe-ioam [trace] [pot] [ppc <encap|decap>]",
616 dst_addr, outer_fib_index, ipv4_set,
626 vxlan_gpe_enable_disable_ioam_for_dest
631 FIB_PROTOCOL_IP4), 1 );
643 ip46_address_t dst_addr;
649 u32 outer_fib_index = 0;
664 else if (
unformat (input,
"outer-fib-index %d", &outer_fib_index))
668 else if (
unformat (input,
"disable"))
674 if (dst_addr_set == 0)
676 if (ipv4_set && ipv6_set)
681 dst_addr, outer_fib_index,
687 (vm, dst_addr, outer_fib_index, ipv4_set);
694 .path =
"set vxlan-gpe-ioam-transit",
695 .short_help =
"set vxlan-gpe-ioam-transit dst-ip <dst_ip> [outer-fib-index <outer_fib_index>] [disable]",
709 .path =
"clear vxlan-gpe-ioam rewrite",
710 .short_help =
"clear vxlan-gpe-ioam rewrite",
u16 lb_n_buckets
number of buckets in the load-balance.
fib_protocol_t fp_proto
protocol type
clib_error_t * vxlan_gpe_ioam_enable(int has_trace_option, int has_pot_option, int has_ppc_option)
uword * vxlan6_gpe_tunnel_by_key
lookup IPv6 VXLAN GPE tunnel by key
Recursive resolution source.
void vxlan_gpe_set_next_override(uword next)
vnet_main_t * vnet_get_main(void)
vlib_main_t * vlib_main
State convenience vlib_main_t.
#define VXLAN_GPE_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT
vnet_interface_main_t interface_main
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
int vxlan_gpe_enable_disable_ioam_for_dest(vlib_main_t *vm, ip46_address_t dst_addr, u32 outer_fib_index, u8 is_ipv4, u8 is_add)
int vxlan6_gpe_rewrite(vxlan_gpe_tunnel_t *t, u32 extension_size, u8 protocol_override, uword encap_next_node)
Calculate IPv6 VXLAN GPE rewrite header.
#define hash_set_mem(h, key, value)
fib_node_index_t fib_entry_index
clib_error_t * vxlan_gpe_ioam_clear(vxlan_gpe_tunnel_t *t, int has_trace_option, int has_pot_option, int has_ppc_option, u8 ipv6_set)
uword decap_v4_next_override
void vxlan_gpe_ioam_interface_init(void)
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.
u8 protocol
see vxlan_gpe_protocol_t
#define clib_memcpy(d, s, n)
clib_error_t * clear_vxlan_gpe_ioam_rewrite_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
clib_error_t * vxlan_gpe_ioam_disable(int has_trace_option, int has_pot_option, int has_ppc_option)
int vxlan_gpe_ioam_disable_for_dest(vlib_main_t *vm, ip46_address_t dst_addr, u32 outer_fib_index, u8 ipv4_set)
vxlan_gpe_ioam_main_t vxlan_gpe_ioam_main
Aggregrate type for a prefix.
#define clib_error_return(e, args...)
static clib_error_t * vxlan_gpe_set_ioam_rewrite_command_fn(vlib_main_t *vm, unformat_input_t() *input, vlib_cli_command_t *cmd)
#define hash_get_pair(h, key)
u16 fp_len
The mask length.
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
u8 * rewrite
Rewrite string.
VXLAN GPE packet header structure.
static void vxlan_gpe_set_clear_output_feature_on_intf(vlib_main_t *vm, u32 sw_if_index0, u8 is_add)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
int vxlan4_gpe_rewrite(vxlan_gpe_tunnel_t *t, u32 extension_size, u8 protocol_override, uword encap_next_node)
Calculate IPv4 VXLAN GPE rewrite header.
#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.
#define hash_unset_mem(h, key)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Struct for VXLAN GPE tunnel.
dpo_type_t dpoi_type
the type
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
load-balancing over a choice of [un]equal cost paths
#define pool_put(P, E)
Free an object E in pool P.
vxlan_gpe_main_t vxlan_gpe_main
u8 protocol
encapsulated protocol
int vxlan_gpe_trace_profile_setup(void)
An node in the FIB graph.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
#define VXLAN_GPE_OPTION_TYPE_IOAM_TRACE
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a 'special' entry to the FIB.
clib_error_t * vxlan_gpe_ioam_set(vxlan_gpe_tunnel_t *t, int has_trace_option, int has_pot_option, int has_ppc_option, u8 ipv6_set)
static fib_node_t * vxlan_gpe_ioam_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
vxlan_gpe_ioam_dest_tunnels_t * dst_tunnels
#define vec_free(V)
Free vector's memory (no header).
u32 fib_node_index_t
A typedef of a node index.
fib_entry_t * fib_entry_get(fib_node_index_t index)
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
fib_node_t node
Linkage into the FIB object graph.
int(* add_options[256])(u8 *rewrite_string, u8 *rewrite_size)
void vxlan_gpe_refresh_output_feature_on_all_dest(void)
u8 rewrite_size
rewrite size for dynamic plugins like iOAM
Struct for VXLAN GPE node state.
static load_balance_t * load_balance_get(index_t lbi)
static void clib_mem_free(void *p)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
int vxlan_gpe_ioam_clear_rewrite(vxlan_gpe_tunnel_t *t, int has_trace_option, int has_pot_option, int has_ppc_option, u8 ipv6_set)
static void * clib_mem_alloc(uword size)
fib_forward_chain_type_t fib_entry_get_default_chain_type(const fib_entry_t *fib_entry)
u8 * bool_ref_by_sw_if_index
per sw_if_index, to maintain bitmap
vxlan_gpe_tunnel_t * tunnels
vector of encap tunnel instances
dpo_id_t fe_lb
The load-balance used for forwarding.
static fib_node_back_walk_rc_t vxlan_gpe_ioam_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node.
uword * vxlan4_gpe_tunnel_by_key
lookup IPv4 VXLAN GPE tunnel by key
fib_node_type_t fib_entry_type
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VXLAN GPE Extension (iOAM) Header definition.
vnet_sw_interface_t * sw_interfaces
void vxlan_gpe_clear_output_feature_on_all_intfs(vlib_main_t *vm)
#define hash_get_mem(h, key)
void vxlan_gpe_clear_output_feature_on_select_intfs(void)
A FIB graph nodes virtual function table.
static void vxlan_gpe_ioam_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
#define clib_error_return_code(e, code, flags, args...)
static clib_error_t * vxlan_gpe_set_ioam_flags_command_fn(vlib_main_t *vm, unformat_input_t() *input, vlib_cli_command_t *cmd)
int vxlan_gpe_ioam_set_rewrite(vxlan_gpe_tunnel_t *t, int has_trace_option, int has_pot_option, int has_ppc_option, u8 ipv6_set)
#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
static clib_error_t * vxlan_gpe_set_ioam_transit_rewrite_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int vxlan_gpe_trace_profile_cleanup(void)
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)
static uword pool_elts(void *v)
Number of active elements in a pool.