summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-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
4 files changed, 32 insertions, 20 deletions
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
{