43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 50 #define foreach_vpe_api_msg \ 51 _(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \ 52 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \ 53 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del) \ 54 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \ 55 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \ 56 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \ 57 _(MPLS_FIB_DUMP, mpls_fib_dump) 88 vl_api_mpls_table_add_del_reply_t *rmp;
109 u32 mpls_fib_index, ip_fib_index;
114 if (~0 == mpls_fib_index)
116 return VNET_API_ERROR_NO_SUCH_FIB;
123 if (~0 == ip_fib_index)
124 return VNET_API_ERROR_NO_SUCH_FIB;
156 vl_api_mpls_ip_bind_unbind_reply_t *rmp;
174 u32 fib_index, next_hop_fib_index;
175 int rv, ii, n_labels;;
198 &fib_index, &next_hop_fib_index);
204 memset (&nh, 0,
sizeof (nh));
207 memcpy (&nh.ip4, mp->
mr_next_hop, sizeof (nh.ip4));
209 memcpy (&nh.ip6, mp->
mr_next_hop, sizeof (nh.ip6));
217 for (ii = 0; ii < n_labels; ii++)
260 vl_api_mpls_route_add_del_reply_t *rmp;
306 u32 tunnel_sw_if_index;
309 u32 next_hop_via_label;
311 memset (&rpath, 0,
sizeof (rpath));
359 if (~0 == tunnel_sw_if_index)
387 vl_api_sw_interface_set_mpls_enable_reply_t *rmp;
397 REPLY_MACRO (VL_API_SW_INTERFACE_SET_MPLS_ENABLE_REPLY);
428 mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
481 path_count =
vec_len (api_rpaths);
485 memset (mp, 0,
sizeof (*mp));
486 mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
493 mp->
label = htonl (label);
495 mp->
count = htonl (path_count);
544 mpls_fib_table_walk (mpls_fib,
545 vl_api_mpls_fib_dump_table_walk,
574 #define vl_msg_name_crc_list 576 #undef vl_msg_name_crc_list 581 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 582 foreach_vl_msg_name_crc_mpls;
592 vl_msg_api_set_handlers(VL_API_##N, #n, \ 593 vl_api_##n##_t_handler, \ 595 vl_api_##n##_t_endian, \ 596 vl_api_##n##_t_print, \ 597 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)
ip46_address_t frp_addr
The next-hop address.
Continue on to the next entry.
void mpls_table_delete(u32 table_id, u8 is_api)
A representation of a fib path for fib_path_encode to convey the information to the caller...
struct vl_api_mpls_fib_dump_table_walk_ctx_t_ vl_api_mpls_fib_dump_table_walk_ctx_t
mpls_eos_bit_t frp_eos
EOS bit for the resolving label.
void mpls_table_create(u32 table_id, u8 is_api, const u8 *name)
A representation of a path as described by a route producer.
vnet_main_t * vnet_get_main(void)
u8 mt_next_hop_n_out_labels
fib_node_index_t mt_path_list
The path-list over which the tunnel's destination is reachable.
int size
for sanity checking
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, fib_source_t src, const u8 *name)
Get the index of the FIB for a Table-ID.
#define REPLY_MACRO2(t, body)
static void send_mpls_tunnel_entry(u32 mti, void *arg)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
struct mpls_tunnel_send_walk_ctx_t_ mpls_tunnel_send_walk_ctx_t
A uni-directional MPLS tunnel.
u32 mr_classify_table_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
dpo_proto_t frp_proto
The protocol of the address below.
u32 mt_next_hop_sw_if_index
const mpls_tunnel_t * mpls_tunnel_get(u32 mti)
static void send_mpls_fib_details(vpe_api_main_t *am, vl_api_registration_t *reg, const fib_table_t *table, u32 label, u32 eos, fib_route_path_encode_t *api_rpaths, u32 context)
void * vl_msg_api_alloc(int nbytes)
#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
Current trace configuration.
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)
#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)
MPLS Route Add / del route.
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.
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
void vnet_mpls_tunnel_del(u32 sw_if_index)
Delete an MPLS tunnel.
u8 mr_next_hop_n_out_labels
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
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.
Configuration for each label value in the output-stack.
fib_mpls_label_t * frp_label_stack
The outgoing MPLS label Stack.
int add_del_route_check(fib_protocol_t table_proto, u32 table_id, u32 next_hop_sw_if_index, dpo_proto_t next_hop_table_proto, u32 next_hop_table_id, u8 is_rpf_id, u32 *fib_index, u32 *next_hop_fib_index)
Enable or Disable MPLS on and interface.
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
fib_mpls_lsp_mode_t fml_mode
The LSP mode.
API main structure, used by both vpp and binary API clients.
An API client registration, only in vpp/vlib.
#define BAD_SW_IF_INDEX_LABEL
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.
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.
u32 ft_table_id
Table ID (hash key) for this FIB.
vl_api_registration_t * reg
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
#define MPLS_LABEL_INVALID
#define vec_free(V)
Free vector's memory (no header).
u8 * ft_desc
Table description.
#define clib_memcpy(a, b, c)
int mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable, u8 is_api)
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
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.
mpls_label_t fml_value
The label value.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
u8 mr_next_hop_preference
u32 mt_next_hop_via_label
u32 vnet_mpls_tunnel_create(u8 l2_only, u8 is_multicast)
Create a new MPLS tunnel.
int vnet_mpls_tunnel_path_remove(u32 sw_if_index, fib_route_path_t *rpaths)
remove a path from a tunnel.
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
vl_api_fib_path_t path[count]
u8 mr_is_resolve_attached
From the control plane API.
void fib_api_path_encode(const fib_route_path_encode_t *api_rpath, vl_api_fib_path_t *out)
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)
mpls_label_t frp_local_label
The MPLS local Label to reursively resolve through.
void vnet_mpls_tunnel_path_add(u32 sw_if_index, fib_route_path_t *rpaths)
Add a path to an MPLS tunnel.
#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)
static void vl_api_sw_interface_set_mpls_enable_t_handler(vl_api_sw_interface_set_mpls_enable_t *mp)
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
static fib_table_walk_rc_t vl_api_mpls_fib_dump_table_walk(fib_node_index_t fei, void *arg)
vl_api_fib_path_t mt_paths[mt_count]
#define vec_foreach(var, vec)
Vector iterator.
u32 mt_sw_if_index
The SW interface index of the tunnel interfaces.
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_multicast, u8 is_classify, u32 classify_table_index, u8 is_resolve_host, u8 is_resolve_attached, u8 is_interface_rx, u8 is_rpf_id, u8 is_dvr, u8 is_source_lookup, u8 is_udp_encap, u32 fib_index, const fib_prefix_t *prefix, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_id, u32 next_hop_sw_if_index, u8 next_hop_fib_index, u16 next_hop_weight, u16 next_hop_preference, mpls_label_t next_hop_via_label, fib_mpls_label_t *next_hop_out_label_stack)
u8 fml_exp
EXP bits; valid only at imposition.
vpe_api_main_t vpe_api_main
u8 frp_weight
[un]equal cost path weight
vl_api_fib_mpls_label_t mt_next_hop_out_label_stack[mt_next_hop_n_out_labels]
void vl_api_mpls_table_add_del_t_handler(vl_api_mpls_table_add_del_t *mp)
vl_api_fib_mpls_label_t mr_next_hop_out_label_stack[mr_next_hop_n_out_labels]
static void setup_message_id_table(api_main_t *am)
struct mpls_fib_t_ * mpls_fibs
A pool of all the MPLS FIBs.
void vl_api_mpls_ip_bind_unbind_t_handler(vl_api_mpls_ip_bind_unbind_t *mp)
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.