30 ip4_udp_lisp_gpe_header_t * h0;
35 h0 = (ip4_udp_lisp_gpe_header_t *) rw;
49 h0->udp.src_port = clib_host_to_net_u16 (4341);
50 h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_lisp_gpe);
58 ip6_udp_lisp_gpe_header_t * h0;
63 h0 = (ip6_udp_lisp_gpe_header_t *) rw;
68 clib_host_to_net_u32 (0x6 << 28);
77 h0->udp.src_port = clib_host_to_net_u16 (4341);
78 h0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_lisp_gpe);
88 lisp0->
iid = clib_host_to_net_u32 (t->
vni);
94 #define foreach_copy_field \ 111 memset(&key, 0,
sizeof(key));
114 key.
iid = clib_host_to_net_u32 (a->
vni);
122 return VNET_API_ERROR_INVALID_VALUE;
125 return VNET_API_ERROR_INVALID_DECAP_NEXT;
128 memset (t, 0,
sizeof (*t));
131 #define _(x) t->x = a->x; 138 t->
flags |= LISP_GPE_FLAGS_P;
154 tun_index_res[0] = t - lgm->
tunnels;
163 return VNET_API_ERROR_NO_SUCH_ENTRY;
183 memset (&adj, 0,
sizeof(adj));
202 LGPE_IP4_LOOKUP_NEXT_DROP : LGPE_IP6_LOOKUP_NEXT_DROP);
219 u32 adj_index, rv, tun_index = ~0;
220 ip_prefix_t * dpref, * spref;
221 uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
238 memset (&adj, 0,
sizeof(adj));
246 lnip = ip_ver ==
IP4 ?
255 ASSERT(lookup_next_index != 0);
256 ASSERT(lgpe_sw_if_index != 0);
259 adj.rewrite_header.node_index = tun_index;
260 adj.rewrite_header.sw_if_index = lgpe_sw_if_index[0];
268 if (CLIB_DEBUG && a->
is_add)
277 ASSERT(adjp->rewrite_header.node_index == tun_index);
290 ip_address_t slocator, dlocator, *slocators = 0, *dlocators = 0;
306 else if (
unformat (line_input,
"add"))
308 else if (
unformat (line_input,
"eid %U slocator %U dlocator %U",
338 for (i = 0; i <
vec_len(eids); i++)
341 memset (&a, 0,
sizeof(a));
358 .path =
"lisp gpe maptunnel",
359 .short_help =
"lisp gpe maptunnel eid <eid> sloc <src-locator> " 360 "dloc <dst-locator> [del]",
367 u32 next_index = va_arg (*args,
u32);
371 case LISP_GPE_INPUT_NEXT_DROP:
372 return format (s,
"drop");
373 case LISP_GPE_INPUT_NEXT_IP4_INPUT:
375 case LISP_GPE_INPUT_NEXT_IP6_INPUT:
378 return format (s,
"unknown %d", next_index);
390 "[%d] %U (src) %U (dst) fibs: encap %d, decap %d",
400 #define _(n,v) if (t->flags & v) s = format (s, "%s-bit ", #n); 404 s =
format (s,
"next_protocol %d ver_res %x res %x\n",
424 vlib_cli_output (vm,
"%U", format_lisp_gpe_tunnel, t);
431 .path =
"show lisp gpe tunnel",
476 u32 * table_ids = 0, * table_id;
483 vec_add1(tunnels, tunnel[0]);
487 memset(at, 0,
sizeof(at[0]));
498 vec_add1(table_ids, p->key);
529 if (
unformat (line_input,
"enable"))
531 else if (
unformat (line_input,
"disable"))
545 .short_help =
"lisp gpe [enable|disable]",
584 return format (s,
"%s", lgm->
is_en ?
"enabled" :
"disabled");
vlib_node_registration_t lisp_gpe_ip4_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip4_input_node)
sll srl srl sll sra u16x4 i
#define gid_address_type(_a)
u32 ip4_lookup_next_lgpe_ip4_lookup
u8 vnet_lisp_gpe_enable_disable_status(void)
ip_lookup_next_t lookup_next_index
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
lisp_gpe_tunnel_t * tunnels
#define mhash_foreach(k, v, mh, body)
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).
static clib_error_t * show_lisp_gpe_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
ip_lookup_main_t lookup_main
static int add_del_negative_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
uword * lgpe_ip6_lookup_next_index_by_table_id
#define ip_prefix_version(_a)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
vnet_main_t * vnet_get_main(void)
#define foreach_copy_field
#define pool_foreach(VAR, POOL, BODY)
#define VLIB_INIT_FUNCTION(x)
always_inline uword pool_elts(void *v)
#define clib_warning(format, args...)
void ip_address_copy_addr(void *dst, ip_address_t *src)
void vnet_lisp_gpe_add_del_iface(vnet_lisp_gpe_add_del_iface_args_t *a, u32 *hw_if_indexp)
#define vlib_call_init_function(vm, x)
#define ip_addr_version(_a)
vlib_node_registration_t lisp_gpe_ip6_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip6_input_node)
#define pool_elt_at_index(p, i)
mhash_t lisp_gpe_tunnel_by_key
uword * lisp_gpe_hw_if_index_by_table_id
static int lisp_gpe_rewrite(lisp_gpe_tunnel_t *t)
u32 ip6_lookup_next_lgpe_ip6_lookup
u8 * format_gid_address(u8 *s, va_list *args)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
always_inline u16 ip4_header_checksum(ip4_header_t *i)
#define gid_address_ippref(_a)
#define pool_get_aligned(P, E, A)
clib_error_t * ip_main_init(vlib_main_t *vm)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
vlib_node_registration_t lgpe_ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (lgpe_ip4_lookup_node)
int ip_sd_fib_add_del_route(lisp_gpe_main_t *lgm, ip_prefix_t *dst_prefix, ip_prefix_t *src_prefix, u32 table_id, ip_adjacency_t *add_adj, u8 is_add)
#define vec_free(V)
Free vector's memory (no header).
u32 ip_sd_fib_get_route(lisp_gpe_main_t *lgm, ip_prefix_t *dst_prefix, ip_prefix_t *src_prefix, u32 table_id)
lisp_gpe_main_t lisp_gpe_main
#define VLIB_CLI_COMMAND(x,...)
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
struct _gid_address_t gid_address_t
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
u8 * format_ip_address(u8 *s, va_list *args)
ip_lookup_main_t lookup_main
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
vlib_node_registration_t lgpe_ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (lgpe_ip6_lookup_node)
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
always_inline ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
negative_fwd_actions_e action
static clib_error_t * lisp_gpe_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
static u8 * format_decap_next(u8 *s, va_list *args)
static u32 add_del_ip_tunnel(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *tun_index_res)
#define vec_foreach(var, vec)
Vector iterator.
u8 * format_lisp_gpe_tunnel(u8 *s, va_list *args)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
#define clib_error_return(e, args...)
#define CLIB_CACHE_LINE_BYTES
void ip_prefix_copy(void *dst, void *src)
uword * lgpe_ip4_lookup_next_index_by_table_id
always_inline uword * mhash_get(mhash_t *h, void *key)
void ip_address_copy(ip_address_t *dst, ip_address_t *src)
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)