u32 tunnel_sw_if_index;
int ii;
fib_route_path_t rpath, *rpaths = NULL;
+ u32 next_hop_via_label;
memset (&rpath, 0, sizeof (rpath));
rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index);
rpath.frp_weight = 1;
+ next_hop_via_label = ntohl (mp->mt_next_hop_via_label);
+ if ((MPLS_LABEL_INVALID != next_hop_via_label) && (0 != next_hop_via_label))
+ {
+ rpath.frp_proto = DPO_PROTO_MPLS;
+ rpath.frp_local_label = next_hop_via_label;
+ rpath.frp_eos = MPLS_NON_EOS;
+ }
+
if (mp->mt_is_add)
{
for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++)
fp = mp->mt_paths;
vec_foreach (api_rpath, api_rpaths)
{
- memset (fp, 0, sizeof (*fp));
-
- fp->weight = api_rpath->rpath.frp_weight;
- fp->preference = api_rpath->rpath.frp_preference;
- fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
- copy_fib_next_hop (api_rpath, fp);
+ fib_api_path_encode (api_rpath, fp);
fp++;
}
send_mpls_fib_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
const fib_table_t * table,
- u32 label, u32 eos,
+ const fib_prefix_t * pfx,
fib_route_path_encode_t * api_rpaths, u32 context)
{
vl_api_mpls_fib_details_t *mp;
mp->table_id = htonl (table->ft_table_id);
memcpy (mp->table_name, table->ft_desc,
clib_min (vec_len (table->ft_desc), sizeof (mp->table_name)));
- mp->eos_bit = eos;
- mp->label = htonl (label);
+ mp->eos_bit = pfx->fp_eos;
+ mp->label = htonl (pfx->fp_label);
mp->count = htonl (path_count);
fp = mp->path;
vec_foreach (api_rpath, api_rpaths)
{
- memset (fp, 0, sizeof (*fp));
- fp->weight = api_rpath->rpath.frp_weight;
- fp->preference = api_rpath->rpath.frp_preference;
- fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
- copy_fib_next_hop (api_rpath, fp);
+ fib_api_path_encode (api_rpath, fp);
fp++;
}
fib_table_t *fib_table;
mpls_fib_t *mpls_fib;
fib_node_index_t *lfeip = NULL;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
u32 fib_index;
fib_route_path_encode_t *api_rpaths;
vl_api_mpls_fib_dump_table_walk_ctx_t ctx = {
vec_foreach (lfeip, ctx.lfeis)
{
- fib_entry_get_prefix (*lfeip, &pfx);
+ pfx = fib_entry_get_prefix (*lfeip);
fib_index = fib_entry_get_fib_index (*lfeip);
- fib_table = fib_table_get (fib_index, pfx.fp_proto);
+ fib_table = fib_table_get (fib_index, pfx->fp_proto);
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
- send_mpls_fib_details (am, reg,
- fib_table, pfx.fp_label,
- pfx.fp_eos, api_rpaths, mp->context);
+ send_mpls_fib_details (am, reg, fib_table, pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}