41 ip_address_t lloc, rloc;
44 u8 reid_set = 0, leid_set = 0, is_negative = 0, dp_table_set = 0,
46 u32 vni = 0, dp_table = 0, action = ~0, w;
50 memset (leid, 0,
sizeof (*leid));
51 memset (reid, 0,
sizeof (*reid));
61 else if (
unformat (line_input,
"add"))
71 else if (
unformat (line_input,
"vni %u", &vni))
77 else if (
unformat (line_input,
"vrf %u", &dp_table))
81 else if (
unformat (line_input,
"bd %u", &dp_table))
85 else if (
unformat (line_input,
"negative action %U",
90 else if (
unformat (line_input,
"loc-pair %U %U w %d",
148 memset (a, 0,
sizeof (a[0]));
163 is_add ?
"add" :
"delete");
175 .short_help =
"gpe entry add/del vni <vni> vrf/bd <id> [leid <leid>]" 176 "reid <reid> [loc-pair <lloc> <rloc> w <weight>] " 177 "[negative action <action>]",
222 return VNET_API_ERROR_INVALID_GPE_MODE;
225 return VNET_API_ERROR_LISP_GPE_ENTRIES_PRESENT;
249 else if (
unformat (line_input,
"vxlan"))
261 "Error: invalid mode or GPE entries are present!");
270 .short_help =
"gpe encap [lisp|vxlan]",
284 return format (s,
"lisp");
286 return format (s,
"vxlan");
305 .path =
"show gpe encap",
306 .short_help =
"show GPE encapulation mode",
328 if (
unformat (line_input,
"enable"))
330 else if (
unformat (line_input,
"disable"))
351 .short_help =
"gpe [enable|disable]",
369 vlib_cli_output (vm,
"%=10d%=10d", p->key, p->value[0]);
378 vlib_cli_output (vm,
"%=10d%=10d", p->key, p->value[0]);
387 .path =
"show gpe interface",
388 .short_help =
"show gpe interface",
426 .path =
"show gpe native-forward",
427 .short_help =
"show gpe native-forward",
499 memset (&rpath, 0,
sizeof (rpath));
503 if (
unformat (line_input,
"table %d", &table_id))
505 else if (
unformat (line_input,
"del"))
507 else if (
unformat (line_input,
"via %U %U",
516 else if (
unformat (line_input,
"via %U %U",
525 else if (
unformat (line_input,
"via %U",
532 else if (
unformat (line_input,
"via %U",
546 if ((
u32) ~ 0 == table_id)
576 .path =
"gpe native-forward",
577 .short_help =
"gpe native-forward [del] via <nh-ip-addr> [iface] " 588 return format (s,
"%s", lgm->
is_en ?
"enabled" :
"disabled");
647 memset (&pm, 0,
sizeof (pm));
674 (
u8 *)
"interface-tx");
693 if (
unformat (input,
"pcap %v", &file_name))
712 .path =
"test one nsh",
713 .short_help =
"test gpe nsh pcap <path-to-pcap-file>",
static clib_error_t * lisp_test_nsh_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define gid_address_ip_version(_a)
ip46_address_t frp_addr
The next-hop address.
char * file_name
File name of pcap output.
vlib_node_registration_t lisp_gpe_ip4_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip4_input_node)
#define gid_address_type(_a)
static clib_error_t * gpe_native_forward_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to add action for native forward.
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
A representation of a path as described by a route producer.
int fib_route_path_cmp(const fib_route_path_t *rpath1, const fib_route_path_t *rpath2)
vnet_main_t * vnet_get_main(void)
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix
void vnet_lisp_gpe_fwd_entry_flush(void)
Flush all the forwrding entries.
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Enable/disable LISP-GPE.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
lisp_gpe_fwd_entry_key_t * key
The Entry's key: {lEID,rEID,vni}.
ip_lookup_main_t lookup_main
dpo_proto_t frp_proto
The protocol of the address below.
unformat_function_t unformat_vnet_sw_interface
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
vlib_main_t * vlib_main
convenience
uword unformat_negative_mapping_action(unformat_input_t *input, va_list *args)
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
PCAP main state data structure.
void gpe_update_native_fwd_path(u8 ip_version)
u32 frp_sw_if_index
The interface.
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * gpe_set_encap_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to set GPE encap.
vlib_combined_counter_main_t counters
Aggregrate type for a prefix.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
uword * lisp_gpe_fwd_entries
DB of all forwarding entries.
#define clib_error_create(args...)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
#define vlib_call_init_function(vm, x)
enum gpe_encap_mode_e gpe_encap_mode_t
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
vlib_node_registration_t lisp_gpe_ip6_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip6_input_node)
#define hash_create_mem(elts, key_bytes, value_bytes)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u32 table_id
table (vrf) id
static void * vlib_buffer_put_uninit(vlib_buffer_t *b, u8 size)
Append uninitialized data to buffer.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
uword unformat_gid_address(unformat_input_t *input, va_list *args)
#define vec_del1(v, i)
Delete the element at index I.
int vnet_gpe_add_del_native_fwd_rpath(vnet_gpe_native_fwd_rpath_args_t *a)
clib_error_t * pcap_read(pcap_main_t *pm)
Read PCAP file.
u8 is_negative
type of mapping
u32 vni
VNI/tenant id in HOST byte order.
clib_error_t * ip_main_init(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * lisp_show_iface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show LISP-GPE interfaces.
tunnel_lookup_t l2_ifaces
void lisp_gpe_tenant_flush(void)
Flush/delete ALL the tenants.
#define clib_memcpy(a, b, c)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
#define VLIB_CLI_COMMAND(x,...)
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Forwarding entry create/remove dispatcher.
struct _gid_address_t gid_address_t
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
Format LISP-GPE status.
gpe_encap_mode_t vnet_gpe_get_encap_mode(void)
ip_lookup_main_t lookup_main
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
LISP-GPE init function.
gpe_encap_mode_t encap_mode
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
static clib_error_t * lisp_gpe_test_send_nsh_packet(u8 *file_name)
static clib_error_t * gpe_show_native_fwd_rpath_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show GPE fwd native route path.
int vnet_gpe_set_encap_mode(gpe_encap_mode_t mode)
Set GPE encapsulation mode.
gid_address_t rmt_eid
remote eid
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
static clib_error_t * gpe_show_encap_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show GPE encap.
negative_fwd_actions_e action
action for negative mappings
#define gid_address_vni(_a)
u32 eid_fib_index
The FIB index for the overlay, i.e.
struct lisp_gpe_fwd_entry_t_ * lisp_fwd_entry_pool
A Pool of all LISP forwarding entries.
static clib_error_t * lisp_gpe_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to enable/disable LISP-GPE.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
tunnel_lookup_t l3_ifaces
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
locator_pair_t * locator_pairs
vector of locator pairs
char * name
The counter collection's name.
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
fib_route_path_t * native_fwd_rpath[2]
Native fwd data structures.
ip4_main_t ip4_main
Global ip4 main structure.
#define vec_foreach(var, vec)
Vector iterator.
static void * vlib_buffer_pull(vlib_buffer_t *b, u8 size)
Retrieve bytes from buffer head.
u8 ** packets_read
Packets read from file.
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
uword * lisp_stats_index_by_key
u8 * format_vnet_gpe_encap_mode(u8 *s, va_list *args)
Format GPE encap mode.
u8 frp_weight
[un]equal cost path weight
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
gid_address_t lcl_eid
local eid
tunnel_lookup_t nsh_ifaces
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static clib_error_t * lisp_gpe_add_del_fwd_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to add/del forwarding entry.
static uword pool_elts(void *v)
Number of active elements in a pool.