41 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 48 #define foreach_vpe_api_msg \ 49 _(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \ 50 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \ 51 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \ 52 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \ 53 _(MPLS_FIB_DUMP, mpls_fib_dump) 62 u32 mpls_fib_index, ip_fib_index;
67 if (~0 == mpls_fib_index)
76 return VNET_API_ERROR_NO_SUCH_FIB;
83 if (~0 == ip_fib_index)
84 return VNET_API_ERROR_NO_SUCH_FIB;
133 u32 fib_index, next_hop_fib_index;
135 int rv, ii, n_labels;;
165 &fib_index, &next_hop_fib_index);
171 memset (&nh, 0,
sizeof (nh));
174 memcpy (&nh.ip4, mp->
mr_next_hop, sizeof (nh.ip4));
176 memcpy (&nh.ip6, mp->
mr_next_hop, sizeof (nh.ip6));
181 else if (1 == n_labels)
186 for (ii = 0; ii < n_labels; ii++)
229 u32 tunnel_sw_if_index;
239 memset (&rpath, 0,
sizeof (rpath));
305 memset (mp, 0,
sizeof (*mp));
306 mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
346 path_count =
vec_len (api_rpaths);
350 memset (mp, 0,
sizeof (*mp));
351 mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
356 mp->
label = htonl (label);
358 mp->
count = htonl (path_count);
362 memset (fp, 0,
sizeof (*fp));
392 hash_foreach(key, lfei, fib_table->mpls.mf_entries,
394 vec_add1(lfeis, lfei);
408 fib_table->ft_table_id,
409 pfx.fp_label, pfx.fp_eos, api_rpaths, mp->context);
423 #define vl_msg_name_crc_list 425 #undef vl_msg_name_crc_list 430 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 431 foreach_vl_msg_name_crc_mpls;
441 vl_msg_api_set_handlers(VL_API_##N, #n, \ 442 vl_api_##n##_t_handler, \ 444 vl_api_##n##_t_endian, \ 445 vl_api_##n##_t_print, \ 446 sizeof(vl_api_##n##_t), 1); Bind/Unbind an MPLS local label to an IP prefix.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
fib_protocol_t fp_proto
protocol type
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
fib_protocol_t frp_proto
The protocol of the address below.
ip46_address_t frp_addr
The next-hop address.
A representation of a fib path for fib_path_encode to convey the information to the caller...
mpls_label_t * mt_label_stack
The Label stack to apply to egress packets.
A representation of a path as described by a route producer.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
vnet_main_t * vnet_get_main(void)
u8 mt_next_hop_n_out_labels
u32 mr_next_hop_out_label_stack[mr_next_hop_n_out_labels]
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
#define REPLY_MACRO2(t, body)
static void send_mpls_tunnel_entry(u32 mti, void *arg)
struct mpls_tunnel_send_walk_ctx_t_ mpls_tunnel_send_walk_ctx_t
A uni-directional MPLS tunnel.
u32 mpls_label_t
A label value only, i.e.
u32 mr_classify_table_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
u8 mb_create_table_if_needed
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
u8 mr_next_hop_proto_is_ip4
u32 mt_next_hop_sw_if_index
vl_api_fib_path2_t path[count]
const mpls_tunnel_t * mpls_tunnel_get(u32 mti)
#define foreach_vpe_api_msg
void fib_table_entry_local_label_remove(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
remove a MPLS local label for the prefix/route.
trace_cfg_t * api_trace_cfg
Reply for MPLS IP bind/unbind request.
static void vl_api_mpls_tunnel_add_del_t_handler(vl_api_mpls_tunnel_add_del_t *mp)
void vl_api_mpls_route_add_del_t_handler(vl_api_mpls_route_add_del_t *mp)
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
static void vl_api_mpls_fib_dump_t_handler(vl_api_mpls_fib_dump_t *mp)
static void send_mpls_fib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, u32 label, u32 eos, fib_route_path_encode_t *api_rpaths, u32 context)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u32 frp_sw_if_index
The interface.
static clib_error_t * mpls_api_hookup(vlib_main_t *vm)
Aggregrate type for a prefix.
void stats_dsunlock(void)
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)
u16 fp_len
The mask length.
Dump mpls eth tunnel table.
int fib_entry_cmp_for_sort(void *i1, void *i2)
u32 mr_next_hop_via_label
vnet_api_error_t api_errno
int add_del_route_check(fib_protocol_t table_proto, u32 table_id, u32 next_hop_sw_if_index, fib_protocol_t next_hop_table_proto, u32 next_hop_table_id, u8 create_missing_tables, u32 *fib_index, u32 *next_hop_fib_index)
void vnet_mpls_tunnel_del(u32 sw_if_index)
u8 mr_next_hop_n_out_labels
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
u32 mt_next_hop_out_labels[mt_next_hop_n_labels]
u8 mt_next_hop_proto_is_ip4
static int mpls_ip_bind_unbind_handler(vnet_main_t *vnm, vl_api_mpls_ip_bind_unbind_t *mp)
MPLS Route Add / del route.
struct fib_table_t_ * fibs
A pool of all the MPLS FIBs.
u32 mt_next_hop_out_label_stack[mt_next_hop_n_out_labels]
static int mpls_route_add_del_t_handler(vnet_main_t *vnm, vl_api_mpls_route_add_del_t *mp)
Reply for MPLS tunnel add / del request.
void * vl_msg_api_alloc(int nbytes)
fib_node_index_t fib_table_entry_local_label_add(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
Add a MPLS local label for the prefix/route.
#define vec_free(V)
Free vector's memory (no header).
u32 frp_weight
[un]equal cost path weight
#define clib_memcpy(a, b, c)
u32 fib_node_index_t
A typedef of a node index.
void mpls_tunnel_walk(mpls_tunnel_walk_cb_t cb, void *ctx)
Walk all the MPLS tunnels.
int add_del_route_t_handler(u8 is_multipath, u8 is_add, u8 is_drop, u8 is_unreach, u8 is_prohibit, u8 is_local, u8 is_classify, u32 classify_table_index, u8 is_resolve_host, u8 is_resolve_attached, u32 fib_index, const fib_prefix_t *prefix, u8 next_hop_proto_is_ip4, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u8 next_hop_fib_index, u32 next_hop_weight, mpls_label_t next_hop_via_label, mpls_label_t *next_hop_out_label_stack)
Reply for MPLS route add / del request.
unix_shared_memory_queue_t * q
void vnet_mpls_tunnel_add(fib_route_path_t *rpaths, mpls_label_t *label_stack, u8 l2_only, u32 *sw_if_index)
Create a new MPLS tunnel.
MPLS tunnel Add / del route.
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u8 mr_is_resolve_attached
u32 mr_next_hop_sw_if_index
void fib_entry_encode(fib_node_index_t fib_entry_index, fib_route_path_encode_t **api_rpaths)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_mpls_tunnel_dump_t_handler(vl_api_mpls_tunnel_dump_t *mp)
VLIB_API_INIT_FUNCTION(mpls_api_hookup)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
void stats_dslock_with_hint(int hint, int tag)
void copy_fib_next_hop(fib_route_path_encode_t *api_rpath, void *fp_arg)
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
#define vec_foreach(var, vec)
Vector iterator.
mpls eth tunnel operational state response
vpe_api_main_t vpe_api_main
static void setup_message_id_table(api_main_t *am)
u8 mr_create_table_if_needed
void vl_api_mpls_ip_bind_unbind_t_handler(vl_api_mpls_ip_bind_unbind_t *mp)
A protocol Independent FIB table.
struct _unix_shared_memory_queue unix_shared_memory_queue_t