aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/fib')
-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
6 files changed, 67 insertions, 14 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? */