aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-09-12 09:45:04 -0700
committerFlorin Coras <florin.coras@gmail.com>2017-09-13 17:31:13 +0000
commit2297af016d4c1ecdd0c695dc736e8f5a988e89bd (patch)
treef887e39e50144e5052d0058605ed63cfa40c01f9 /src/vnet
parent49fe046e431c4d76b0c45c609e05e1b0a3063360 (diff)
Add a name to the creation of an IP and MPLS table
Change-Id: I4b4648831551519b2ffb6f93255d28a4b8726c22 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/fib/fib_entry.c6
-rw-r--r--src/vnet/fib/fib_table.c44
-rw-r--r--src/vnet/fib/fib_table.h25
-rw-r--r--src/vnet/fib/fib_test.c2
-rw-r--r--src/vnet/fib/ip4_fib.c2
-rw-r--r--src/vnet/fib/ip6_fib.c2
-rw-r--r--src/vnet/ip/ip.api12
-rw-r--r--src/vnet/ip/ip.h3
-rw-r--r--src/vnet/ip/ip_api.c32
-rwxr-xr-xsrc/vnet/ip/lookup.c5
-rw-r--r--src/vnet/mfib/mfib_table.c44
-rw-r--r--src/vnet/mfib/mfib_table.h25
-rw-r--r--src/vnet/mfib/mfib_test.c2
-rw-r--r--src/vnet/mpls/mpls.api5
-rw-r--r--src/vnet/mpls/mpls.c5
-rw-r--r--src/vnet/mpls/mpls.h40
-rw-r--r--src/vnet/mpls/mpls_api.c24
17 files changed, 208 insertions, 70 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 4cb6cf6050c..4c9b1abd881 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -94,8 +94,7 @@ format_fib_source (u8 * s, va_list * args)
{
fib_source_t source = va_arg (*args, int);
- s = format (s, "\n src:%s ",
- fib_source_names[source]);
+ s = format (s, "src:%s", fib_source_names[source]);
return (s);
}
@@ -125,8 +124,7 @@ format_fib_entry (u8 * s, va_list * args)
FOR_EACH_SRC_ADDED(fib_entry, src, source,
({
- s = format (s, "\n src:%U ",
- format_fib_source, source);
+ s = format (s, "\n %U", format_fib_source, source);
s = fib_entry_src_format(fib_entry, source, s);
s = format (s, " refs:%d ", src->fes_ref_count);
if (FIB_ENTRY_FLAG_NONE != src->fes_entry_flags) {
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index 75d15628c26..ba1e27209c0 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -1037,10 +1037,11 @@ fib_table_find (fib_protocol_t proto,
return (~0);
}
-u32
-fib_table_find_or_create_and_lock (fib_protocol_t proto,
- u32 table_id,
- fib_source_t src)
+static u32
+fib_table_find_or_create_and_lock_i (fib_protocol_t proto,
+ u32 table_id,
+ fib_source_t src,
+ const u8 *name)
{
fib_table_t *fib_table;
fib_node_index_t fi;
@@ -1062,14 +1063,43 @@ fib_table_find_or_create_and_lock (fib_protocol_t proto,
fib_table = fib_table_get(fi, proto);
- fib_table->ft_desc = format(NULL, "%U-VRF:%d",
- format_fib_protocol, proto,
- table_id);
+ if (NULL == fib_table->ft_desc)
+ {
+ if (name && name[0])
+ {
+ fib_table->ft_desc = format(NULL, "%s", name);
+ }
+ else
+ {
+ fib_table->ft_desc = format(NULL, "%U-VRF:%d",
+ format_fib_protocol, proto,
+ table_id);
+ }
+ }
return (fi);
}
u32
+fib_table_find_or_create_and_lock (fib_protocol_t proto,
+ u32 table_id,
+ fib_source_t src)
+{
+ return (fib_table_find_or_create_and_lock_i(proto, table_id,
+ src, NULL));
+}
+
+u32
+fib_table_find_or_create_and_lock_w_name (fib_protocol_t proto,
+ u32 table_id,
+ fib_source_t src,
+ const u8 *name)
+{
+ return (fib_table_find_or_create_and_lock_i(proto, table_id,
+ src, name));
+}
+
+u32
fib_table_create_and_lock (fib_protocol_t proto,
fib_source_t src,
const char *const fmt,
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index 6b7011b3316..923d7afff9a 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -644,6 +644,31 @@ extern u32 fib_table_find_or_create_and_lock(fib_protocol_t proto,
/**
* @brief
+ * Get the index of the FIB for a Table-ID. This DOES create the
+ * FIB if it does not exist.
+ *
+ * @paran proto
+ * The protocol of the FIB (and thus the entries therein)
+ *
+ * @param table-id
+ * The Table-ID
+ *
+ * @return fib_index
+ * The index of the FIB
+ *
+ * @param source
+ * The ID of the client/source.
+ *
+ * @param name
+ * The client is choosing the name they want the table to have
+ */
+extern u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto,
+ u32 table_id,
+ fib_source_t source,
+ const u8 *name);
+
+/**
+ * @brief
* Create a new table with no table ID. This means it does not get
* added to the hash-table and so can only be found by using the index returned.
*
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index 572d7f0d156..540289ce989 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -8173,7 +8173,7 @@ lfib_test (void)
/*
* MPLS enable an interface so we get the MPLS table created
*/
- mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
+ mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API, NULL);
mpls_sw_interface_enable_disable(&mpls_main,
tm->hw[0]->sw_if_index,
1, 1);
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index 865e2dd5faf..48dc2c6cd3b 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -551,7 +551,7 @@ ip4_show_fib (vlib_main_t * vm,
}
}
s = format (s, "]");
- vlib_cli_output (vm, "%V", s);
+ vlib_cli_output (vm, "%v", s);
vec_free(s);
/* Show summary? */
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 3ddb8453eaa..f37ae0d2f45 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -615,7 +615,7 @@ ip6_show_fib (vlib_main_t * vm,
}
}
s = format (s, "]");
- vlib_cli_output (vm, "%V", s);
+ vlib_cli_output (vm, "%v", s);
vec_free(s);
/* Show summary? */
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index e57c2fe177d..f26d79436a5 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -27,6 +27,9 @@
@param table_id - table ID associated with the route
This table ID will apply to both the unicats
and mlticast FIBs
+ @param name - A client provided name/tag for the table. If this is
+ not set by the client, then VPP will generate something
+ meaningfull.
*/
autoreply define ip_table_add_del
{
@@ -35,6 +38,7 @@ autoreply define ip_table_add_del
u32 table_id;
u8 is_ipv6;
u8 is_add;
+ u8 name[64];
};
/** \brief Dump IP fib table
@@ -83,6 +87,7 @@ manual_endian manual_print define ip_fib_details
{
u32 context;
u32 table_id;
+ u8 table_name[64];
u8 address_length;
u8 address[4];
u32 count;
@@ -98,10 +103,10 @@ define ip6_fib_dump
u32 context;
};
-/** \brief IP6 FIB table response
+/** \brief IP6 FIB table entry response
@param table_id - IP6 fib table id
- @address_length - mask length
- @address - ip6 prefix
+ @param address_length - mask length
+ @param address - ip6 prefix
@param count - the number of fib_path in path
@param path - array of of fib_path structures
*/
@@ -109,6 +114,7 @@ manual_endian manual_print define ip6_fib_details
{
u32 context;
u32 table_id;
+ u8 table_name[64];
u8 address_length;
u8 address[16];
u32 count;
diff --git a/src/vnet/ip/ip.h b/src/vnet/ip/ip.h
index 788078666b8..7e26bc6c135 100644
--- a/src/vnet/ip/ip.h
+++ b/src/vnet/ip/ip.h
@@ -184,7 +184,8 @@ void ip_del_all_interface_addresses (vlib_main_t * vm, u32 sw_if_index);
extern vlib_node_registration_t ip4_inacl_node;
extern vlib_node_registration_t ip6_inacl_node;
-void ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api);
+void ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api,
+ const u8 * name);
void ip_table_delete (fib_protocol_t fproto, u32 table_id, u8 is_api);
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 384ec3e0ec4..bb29e0bc077 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -180,7 +180,8 @@ copy_fib_next_hop (fib_route_path_encode_t * api_rpath, void *fp_arg)
static void
send_ip_fib_details (vpe_api_main_t * am,
unix_shared_memory_queue_t * q,
- u32 table_id, fib_prefix_t * pfx,
+ const fib_table_t * table,
+ const fib_prefix_t * pfx,
fib_route_path_encode_t * api_rpaths, u32 context)
{
vl_api_ip_fib_details_t *mp;
@@ -196,7 +197,9 @@ send_ip_fib_details (vpe_api_main_t * am,
mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
mp->context = context;
- mp->table_id = htonl (table_id);
+ 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->address_length = pfx->fp_len;
memcpy (mp->address, &pfx->fp_addr.ip4, sizeof (pfx->fp_addr.ip4));
@@ -295,9 +298,7 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp)
fib_table = fib_table_get (fib_index, pfx.fp_proto);
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
- send_ip_fib_details (am, q,
- fib_table->ft_table_id, &pfx, api_rpaths,
- mp->context);
+ send_ip_fib_details (am, q, fib_table, &pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}
@@ -744,7 +745,7 @@ vl_api_ip_table_add_del_t_handler (vl_api_ip_table_add_del_t * mp)
if (mp->is_add)
{
- ip_table_create (fproto, table_id, 1);
+ ip_table_create (fproto, table_id, 1, mp->name);
}
else
{
@@ -1124,7 +1125,8 @@ vl_api_ip_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
}
void
-ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api)
+ip_table_create (fib_protocol_t fproto,
+ u32 table_id, u8 is_api, const u8 * name)
{
u32 fib_index, mfib_index;
@@ -1147,17 +1149,17 @@ ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api)
if (~0 == fib_index)
{
- fib_table_find_or_create_and_lock (fproto, table_id,
- (is_api ?
- FIB_SOURCE_API :
- FIB_SOURCE_CLI));
+ fib_table_find_or_create_and_lock_w_name (fproto, table_id,
+ (is_api ?
+ FIB_SOURCE_API :
+ FIB_SOURCE_CLI), name);
}
if (~0 == mfib_index)
{
- mfib_table_find_or_create_and_lock (fproto, table_id,
- (is_api ?
- MFIB_SOURCE_API :
- MFIB_SOURCE_CLI));
+ mfib_table_find_or_create_and_lock_w_name (fproto, table_id,
+ (is_api ?
+ MFIB_SOURCE_API :
+ MFIB_SOURCE_CLI), name);
}
}
}
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 667c67914d5..d9922f46453 100755
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -695,6 +695,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
unformat_input_t _line_input, *line_input = &_line_input;
clib_error_t *error = NULL;
u32 table_id, is_add;
+ u8 *name = NULL;
is_add = 1;
table_id = ~0;
@@ -711,6 +712,8 @@ vnet_ip_table_cmd (vlib_main_t * vm,
is_add = 0;
else if (unformat (line_input, "add"))
is_add = 1;
+ else if (unformat (line_input, "name %s", &name))
+ ;
else
{
error = unformat_parse_error (line_input);
@@ -732,7 +735,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
{
if (is_add)
{
- ip_table_create (fproto, table_id, 0);
+ ip_table_create (fproto, table_id, 0, name);
}
else
{
diff --git a/src/vnet/mfib/mfib_table.c b/src/vnet/mfib/mfib_table.c
index e5550adc8f7..838864ff7c0 100644
--- a/src/vnet/mfib/mfib_table.c
+++ b/src/vnet/mfib/mfib_table.c
@@ -422,10 +422,11 @@ mfib_table_find (fib_protocol_t proto,
return (~0);
}
-u32
-mfib_table_find_or_create_and_lock (fib_protocol_t proto,
- u32 table_id,
- mfib_source_t src)
+static u32
+mfib_table_find_or_create_and_lock_i (fib_protocol_t proto,
+ u32 table_id,
+ mfib_source_t src,
+ const u8 *name)
{
mfib_table_t *mfib_table;
fib_node_index_t fi;
@@ -445,13 +446,42 @@ mfib_table_find_or_create_and_lock (fib_protocol_t proto,
mfib_table = mfib_table_get(fi, proto);
- mfib_table->mft_desc = format(NULL, "%U-VRF:%d",
- format_fib_protocol, proto,
- table_id);
+ if (NULL == mfib_table->mft_desc)
+ {
+ if (name && name[0])
+ {
+ mfib_table->mft_desc = format(NULL, "%s", name);
+ }
+ else
+ {
+ mfib_table->mft_desc = format(NULL, "%U-VRF:%d",
+ format_fib_protocol, proto,
+ table_id);
+ }
+ }
return (fi);
}
+u32
+mfib_table_find_or_create_and_lock (fib_protocol_t proto,
+ u32 table_id,
+ mfib_source_t src)
+{
+ return (mfib_table_find_or_create_and_lock_i(proto, table_id,
+ src, NULL));
+}
+
+u32
+mfib_table_find_or_create_and_lock_w_name (fib_protocol_t proto,
+ u32 table_id,
+ mfib_source_t src,
+ const u8 *name)
+{
+ return (mfib_table_find_or_create_and_lock_i(proto, table_id,
+ src, name));
+}
+
/**
* @brief Table flush context. Store the indicies of matching FIB entries
* that need to be removed.
diff --git a/src/vnet/mfib/mfib_table.h b/src/vnet/mfib/mfib_table.h
index c6b0b0973a1..93f90dd5d1d 100644
--- a/src/vnet/mfib/mfib_table.h
+++ b/src/vnet/mfib/mfib_table.h
@@ -322,6 +322,31 @@ extern u32 mfib_table_find_or_create_and_lock(fib_protocol_t proto,
u32 table_id,
mfib_source_t source);
+/**
+ * @brief
+ * Get the index of the FIB for a Table-ID. This DOES create the
+ * FIB if it does not exist.
+ *
+ * @paran proto
+ * The protocol of the FIB (and thus the entries therein)
+ *
+ * @param table-id
+ * The Table-ID
+ *
+ * @return fib_index
+ * The index of the FIB
+ *
+ * @param source
+ * The ID of the client/source.
+ *
+ * @param name
+ * The client is choosing the name they want the table to have
+ */
+extern u32 mfib_table_find_or_create_and_lock_w_name(fib_protocol_t proto,
+ u32 table_id,
+ mfib_source_t source,
+ const u8 *name);
+
/**
* @brief
diff --git a/src/vnet/mfib/mfib_test.c b/src/vnet/mfib/mfib_test.c
index 3055844dd59..2562bc14b6a 100644
--- a/src/vnet/mfib/mfib_test.c
+++ b/src/vnet/mfib/mfib_test.c
@@ -1114,7 +1114,7 @@ mfib_test_i (fib_protocol_t PROTO,
/*
* MPLS enable an interface so we get the MPLS table created
*/
- mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
+ mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API, NULL);
mpls_sw_interface_enable_disable(&mpls_main,
tm->hw[0]->sw_if_index,
1, 0);
diff --git a/src/vnet/mpls/mpls.api b/src/vnet/mpls/mpls.api
index bb849998ab3..36488d0c7b9 100644
--- a/src/vnet/mpls/mpls.api
+++ b/src/vnet/mpls/mpls.api
@@ -141,6 +141,9 @@ manual_endian manual_print define mpls_tunnel_details
@param context - sender context, to match reply w/ request
@param mt_table_id - The MPLS table-id the route is added in
@param mt_is_add - Is this a route add or delete
+ @param mt_name - A client provided name/tag for the table. If this
+ is not set by the client, then VPP will generate
+ something meaningfull.
*/
autoreply define mpls_table_add_del
{
@@ -148,6 +151,7 @@ autoreply define mpls_table_add_del
u32 context;
u32 mt_table_id;
u8 mt_is_add;
+ u8 mt_name[64];
};
/** \brief MPLS Route Add / del route
@@ -227,6 +231,7 @@ manual_endian manual_print define mpls_fib_details
{
u32 context;
u32 table_id;
+ u8 table_name[64];
u8 eos_bit;
u32 label;
u32 count;
diff --git a/src/vnet/mpls/mpls.c b/src/vnet/mpls/mpls.c
index 7bdfd8c7c8d..f8bbb8a955e 100644
--- a/src/vnet/mpls/mpls.c
+++ b/src/vnet/mpls/mpls.c
@@ -544,6 +544,7 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
unformat_input_t _line_input, *line_input = &_line_input;
clib_error_t *error = NULL;
u32 table_id, is_add;
+ u8 *name = NULL;
is_add = 1;
table_id = ~0;
@@ -560,6 +561,8 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
is_add = 0;
else if (unformat (line_input, "add"))
is_add = 1;
+ else if (unformat (line_input, "name %s", &name))
+ ;
else
{
error = unformat_parse_error (line_input);
@@ -581,7 +584,7 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
{
if (is_add)
{
- mpls_table_create (table_id, 0);
+ mpls_table_create (table_id, 0, name);
}
else
{
diff --git a/src/vnet/mpls/mpls.h b/src/vnet/mpls/mpls.h
index 8dd92887c7d..cc3eeed035e 100644
--- a/src/vnet/mpls/mpls.h
+++ b/src/vnet/mpls/mpls.h
@@ -23,7 +23,8 @@
#include <vnet/fib/fib_node.h>
#include <vnet/adj/adj.h>
-typedef enum {
+typedef enum
+{
#define mpls_error(n,s) MPLS_ERROR_##n,
#include <vnet/mpls/error.def>
#undef mpls_error
@@ -34,10 +35,11 @@ typedef enum {
* @brief Definition of a callback for receiving MPLS interface state change
* notifications
*/
-typedef void (*mpls_interface_state_change_callback_t)(u32 sw_if_index,
- u32 is_enable);
+typedef void (*mpls_interface_state_change_callback_t) (u32 sw_if_index,
+ u32 is_enable);
-typedef struct {
+typedef struct
+{
/* MPLS FIB index for each software interface */
u32 *fib_index_by_sw_if_index;
@@ -55,12 +57,12 @@ typedef struct {
u8 output_feature_arc_index;
/* IP4 enabled count by software interface */
- u8 * mpls_enabled_by_sw_if_index;
+ u8 *mpls_enabled_by_sw_if_index;
} mpls_main_t;
extern mpls_main_t mpls_main;
-extern clib_error_t * mpls_feature_init(vlib_main_t * vm);
+extern clib_error_t *mpls_feature_init (vlib_main_t * vm);
format_function_t format_mpls_eos_bit;
format_function_t format_mpls_unicast_header_net_byte_order;
@@ -81,24 +83,28 @@ unformat_function_t unformat_mpls_header;
unformat_function_t unformat_pg_mpls_header;
int mpls_sw_interface_enable_disable (mpls_main_t * mm,
- u32 sw_if_index,
- u8 is_enable,
- u8 is_api);
+ u32 sw_if_index,
+ u8 is_enable, u8 is_api);
u8 mpls_sw_interface_is_enabled (u32 sw_if_index);
int mpls_fib_reset_labels (u32 fib_id);
-int
-mpls_dest_cmp(void * a1, void * a2);
+int mpls_dest_cmp (void *a1, void *a2);
-int
-mpls_fib_index_cmp(void * a1, void * a2);
+int mpls_fib_index_cmp (void *a1, void *a2);
-int
-mpls_label_cmp(void * a1, void * a2);
+int mpls_label_cmp (void *a1, void *a2);
-void mpls_table_create(u32 table_id, u8 is_api);
-void mpls_table_delete(u32 table_id, u8 is_api);
+void mpls_table_create (u32 table_id, u8 is_api, const u8 * name);
+void mpls_table_delete (u32 table_id, u8 is_api);
#endif /* included_vnet_mpls_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 38f5b014344..988c2c98232 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -92,7 +92,7 @@ vl_api_mpls_table_add_del_t_handler (vl_api_mpls_table_add_del_t * mp)
vnm->api_errno = 0;
if (mp->mt_is_add)
- mpls_table_create (ntohl (mp->mt_table_id), 1);
+ mpls_table_create (ntohl (mp->mt_table_id), 1, mp->mt_name);
else
mpls_table_delete (ntohl (mp->mt_table_id), 1);
@@ -258,7 +258,7 @@ vl_api_mpls_route_add_del_t_handler (vl_api_mpls_route_add_del_t * mp)
}
void
-mpls_table_create (u32 table_id, u8 is_api)
+mpls_table_create (u32 table_id, u8 is_api, const u8 * name)
{
u32 fib_index;
@@ -276,10 +276,11 @@ mpls_table_create (u32 table_id, u8 is_api)
if (~0 == fib_index)
{
- fib_table_find_or_create_and_lock (FIB_PROTOCOL_MPLS,
- table_id,
- (is_api ?
- FIB_SOURCE_API : FIB_SOURCE_CLI));
+ fib_table_find_or_create_and_lock_w_name (FIB_PROTOCOL_MPLS,
+ table_id,
+ (is_api ?
+ FIB_SOURCE_API :
+ FIB_SOURCE_CLI), name);
}
}
@@ -424,7 +425,8 @@ vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_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,
+ const fib_table_t * table,
+ u32 label, u32 eos,
fib_route_path_encode_t * api_rpaths, u32 context)
{
vl_api_mpls_fib_details_t *mp;
@@ -440,7 +442,9 @@ send_mpls_fib_details (vpe_api_main_t * am,
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
mp->context = context;
- mp->table_id = htonl (table_id);
+ 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);
@@ -512,8 +516,8 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
send_mpls_fib_details (am, q,
- fib_table->ft_table_id,
- pfx.fp_label, pfx.fp_eos, api_rpaths, mp->context);
+ fib_table, pfx.fp_label,
+ pfx.fp_eos, api_rpaths, mp->context);
vec_free (api_rpaths);
}