aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_attached_export.c4
-rw-r--r--src/vnet/fib/fib_entry.h2
-rw-r--r--src/vnet/fib/fib_entry_delegate.c3
-rw-r--r--src/vnet/fib/fib_entry_src.c4
-rw-r--r--src/vnet/fib/fib_node.h2
-rw-r--r--src/vnet/fib/fib_path.c91
-rw-r--r--src/vnet/fib/fib_path_list.c9
-rw-r--r--src/vnet/fib/fib_path_list.h6
-rw-r--r--src/vnet/fib/fib_table.c69
-rw-r--r--src/vnet/fib/fib_table.h16
-rw-r--r--src/vnet/fib/fib_test.c207
-rw-r--r--src/vnet/fib/fib_types.c4
-rw-r--r--src/vnet/fib/fib_types.h14
-rw-r--r--src/vnet/fib/fib_urpf_list.c20
-rw-r--r--src/vnet/fib/ip4_fib.c50
-rw-r--r--src/vnet/fib/ip4_fib.h9
-rw-r--r--src/vnet/fib/ip6_fib.c117
-rw-r--r--src/vnet/fib/ip6_fib.h11
-rw-r--r--src/vnet/fib/mpls_fib.c17
-rw-r--r--src/vnet/fib/mpls_fib.h9
20 files changed, 440 insertions, 224 deletions
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index fd597e3e12c..574131de66a 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -303,8 +303,8 @@ fib_attached_export_import (fib_entry_t *fib_entry,
* may have realloc'd.
*/
fib_entry = fib_entry_get(fei);
- import->faei_export_sibling =
- fib_entry_cover_track(fib_entry_get(import->faei_export_entry), fei);
+ import->faei_export_sibling =
+ fib_entry_cover_track(fib_entry_get(import->faei_export_entry), fei);
fed = fib_entry_delegate_find_or_add(fib_entry,
FIB_ENTRY_DELEGATE_ATTACHED_IMPORT);
diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h
index 44a5f2e6d7f..f258b755741 100644
--- a/src/vnet/fib/fib_entry.h
+++ b/src/vnet/fib/fib_entry.h
@@ -220,7 +220,7 @@ typedef enum fib_entry_flag_t_ {
FIB_ENTRY_FLAG_EXCLUSIVE = (1 << FIB_ENTRY_ATTRIBUTE_EXCLUSIVE),
FIB_ENTRY_FLAG_LOCAL = (1 << FIB_ENTRY_ATTRIBUTE_LOCAL),
FIB_ENTRY_FLAG_IMPORT = (1 << FIB_ENTRY_ATTRIBUTE_IMPORT),
-} fib_entry_flag_t;
+} __attribute__((packed)) fib_entry_flag_t;
/**
* Flags for the source data
diff --git a/src/vnet/fib/fib_entry_delegate.c b/src/vnet/fib/fib_entry_delegate.c
index a0d45f970b3..efe402d1482 100644
--- a/src/vnet/fib/fib_entry_delegate.c
+++ b/src/vnet/fib/fib_entry_delegate.c
@@ -119,6 +119,9 @@ fib_entry_chain_type_to_delegate_type (fib_forward_chain_type_t fct)
return (FIB_ENTRY_DELEGATE_CHAIN_MPLS_NON_EOS);
case FIB_FORW_CHAIN_TYPE_ETHERNET:
return (FIB_ENTRY_DELEGATE_CHAIN_ETHERNET);
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
+ break;
}
ASSERT(0);
return (FIB_ENTRY_DELEGATE_CHAIN_UNICAST_IP4);
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index 1fb040608b4..d54787cd4d1 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -313,6 +313,8 @@ fib_entry_src_collect_forwarding (fib_node_index_t pl_index,
{
case FIB_FORW_CHAIN_TYPE_UNICAST_IP4:
case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
/*
* EOS traffic with no label to stack, we need the IP Adj
*/
@@ -458,6 +460,8 @@ fib_entry_src_mk_lb (fib_entry_t *fib_entry,
{
load_balance_set_urpf(dpo_lb->dpoi_index, ui);
}
+ load_balance_set_fib_entry_flags(dpo_lb->dpoi_index,
+ fib_entry_get_flags_i(fib_entry));
}
void
diff --git a/src/vnet/fib/fib_node.h b/src/vnet/fib/fib_node.h
index 3ad8ee95b64..457dfb7a6b5 100644
--- a/src/vnet/fib/fib_node.h
+++ b/src/vnet/fib/fib_node.h
@@ -31,6 +31,7 @@ typedef enum fib_node_type_t_ {
*/
FIB_NODE_TYPE_WALK,
FIB_NODE_TYPE_ENTRY,
+ FIB_NODE_TYPE_MFIB_ENTRY,
FIB_NODE_TYPE_PATH_LIST,
FIB_NODE_TYPE_PATH,
FIB_NODE_TYPE_ADJ,
@@ -51,6 +52,7 @@ typedef enum fib_node_type_t_ {
#define FIB_NODE_TYPES { \
[FIB_NODE_TYPE_ENTRY] = "entry", \
+ [FIB_NODE_TYPE_MFIB_ENTRY] = "mfib-entry", \
[FIB_NODE_TYPE_WALK] = "walk", \
[FIB_NODE_TYPE_PATH_LIST] = "path-list", \
[FIB_NODE_TYPE_PATH] = "path", \
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index 809e3e166da..080057f37a9 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -23,6 +23,7 @@
#include <vnet/dpo/lookup_dpo.h>
#include <vnet/adj/adj.h>
+#include <vnet/adj/adj_mcast.h>
#include <vnet/fib/fib_path.h>
#include <vnet/fib/fib_node.h>
@@ -960,6 +961,8 @@ fib_path_route_flags_to_cfg_flags (const fib_route_path_t *rpath)
cfg_flags |= FIB_PATH_CFG_FLAG_RESOLVE_HOST;
if (rpath->frp_flags & FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED)
cfg_flags |= FIB_PATH_CFG_FLAG_RESOLVE_ATTACHED;
+ if (rpath->frp_flags & FIB_ROUTE_PATH_LOCAL)
+ cfg_flags |= FIB_PATH_CFG_FLAG_LOCAL;
return (cfg_flags);
}
@@ -1003,28 +1006,25 @@ fib_path_create (fib_node_index_t pl_index,
/*
* deduce the path's tpye from the parementers and save what is needed.
*/
- if (~0 != rpath->frp_sw_if_index)
+ if (path->fp_cfg_flags & FIB_PATH_CFG_FLAG_LOCAL)
{
- if (flags & FIB_PATH_CFG_FLAG_LOCAL)
- {
- path->fp_type = FIB_PATH_TYPE_RECEIVE;
- path->receive.fp_interface = rpath->frp_sw_if_index;
- path->receive.fp_addr = rpath->frp_addr;
- }
- else
- {
- if (ip46_address_is_zero(&rpath->frp_addr))
- {
- path->fp_type = FIB_PATH_TYPE_ATTACHED;
- path->attached.fp_interface = rpath->frp_sw_if_index;
- }
- else
- {
- path->fp_type = FIB_PATH_TYPE_ATTACHED_NEXT_HOP;
- path->attached_next_hop.fp_interface = rpath->frp_sw_if_index;
- path->attached_next_hop.fp_nh = rpath->frp_addr;
- }
- }
+ path->fp_type = FIB_PATH_TYPE_RECEIVE;
+ path->receive.fp_interface = rpath->frp_sw_if_index;
+ path->receive.fp_addr = rpath->frp_addr;
+ }
+ else if (~0 != rpath->frp_sw_if_index)
+ {
+ if (ip46_address_is_zero(&rpath->frp_addr))
+ {
+ path->fp_type = FIB_PATH_TYPE_ATTACHED;
+ path->attached.fp_interface = rpath->frp_sw_if_index;
+ }
+ else
+ {
+ path->fp_type = FIB_PATH_TYPE_ATTACHED_NEXT_HOP;
+ path->attached_next_hop.fp_interface = rpath->frp_sw_if_index;
+ path->attached_next_hop.fp_nh = rpath->frp_addr;
+ }
}
else
{
@@ -1199,7 +1199,7 @@ fib_path_cmp_i (const fib_path_t *path1,
{
res = (path1->fp_type - path2->fp_type);
}
- if (path1->fp_nh_proto != path2->fp_nh_proto)
+ else if (path1->fp_nh_proto != path2->fp_nh_proto)
{
res = (path1->fp_nh_proto - path2->fp_nh_proto);
}
@@ -1770,8 +1770,11 @@ fib_path_contribute_forwarding (fib_node_index_t path_index,
break;
}
- }
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
break;
+ }
+ break;
case FIB_PATH_TYPE_RECURSIVE:
switch (fct)
{
@@ -1781,13 +1784,15 @@ fib_path_contribute_forwarding (fib_node_index_t path_index,
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
fib_path_recursive_adj_update(path, fct, dpo);
break;
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
case FIB_FORW_CHAIN_TYPE_ETHERNET:
ASSERT(0);
break;
}
break;
case FIB_PATH_TYPE_DEAG:
- switch (fct)
+ switch (fct)
{
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
lookup_dpo_add_or_lock_w_table_id(MPLS_FIB_DEFAULT_TABLE_ID,
@@ -1800,7 +1805,9 @@ fib_path_contribute_forwarding (fib_node_index_t path_index,
case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
case FIB_FORW_CHAIN_TYPE_MPLS_EOS:
dpo_copy(dpo, &path->fp_dpo);
- break;
+ break;
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
case FIB_FORW_CHAIN_TYPE_ETHERNET:
ASSERT(0);
break;
@@ -1810,12 +1817,38 @@ fib_path_contribute_forwarding (fib_node_index_t path_index,
dpo_copy(dpo, &path->exclusive.fp_ex_dpo);
break;
case FIB_PATH_TYPE_ATTACHED:
- case FIB_PATH_TYPE_RECEIVE:
- case FIB_PATH_TYPE_SPECIAL:
- ASSERT(0);
+ switch (fct)
+ {
+ case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
+ case FIB_FORW_CHAIN_TYPE_UNICAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
+ case FIB_FORW_CHAIN_TYPE_MPLS_EOS:
+ case FIB_FORW_CHAIN_TYPE_ETHERNET:
+ break;
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
+ {
+ adj_index_t ai;
+
+ /*
+ * Create the adj needed for sending IP multicast traffic
+ */
+ ai = adj_mcast_add_or_lock(path->fp_nh_proto,
+ fib_forw_chain_type_to_link_type(fct),
+ path->attached.fp_interface);
+ dpo_set(dpo, DPO_ADJACENCY_MCAST,
+ fib_forw_chain_type_to_dpo_proto(fct),
+ ai);
+ adj_unlock(ai);
+ }
+ break;
+ }
+ break;
+ case FIB_PATH_TYPE_RECEIVE:
+ case FIB_PATH_TYPE_SPECIAL:
+ dpo_copy(dpo, &path->fp_dpo);
break;
}
-
}
}
diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c
index db9d1af9e3f..ce11cf452cb 100644
--- a/src/vnet/fib/fib_path_list.c
+++ b/src/vnet/fib/fib_path_list.c
@@ -585,8 +585,11 @@ fib_path_list_resolve (fib_path_list_t *path_list)
path_list = fib_path_list_get(path_list_index);
FIB_PATH_LIST_DBG(path_list, "resovled");
- fib_path_list_mk_urpf(path_list);
+ if (!(path_list->fpl_flags & FIB_PATH_LIST_FLAG_NO_URPF))
+ {
+ fib_path_list_mk_urpf(path_list);
+ }
return (path_list);
}
@@ -1025,14 +1028,14 @@ fib_path_list_copy_and_path_remove (fib_node_index_t orig_path_list_index,
*/
void
fib_path_list_contribute_forwarding (fib_node_index_t path_list_index,
- fib_forward_chain_type_t type,
+ fib_forward_chain_type_t fct,
dpo_id_t *dpo)
{
fib_path_list_t *path_list;
path_list = fib_path_list_get(path_list_index);
- fib_path_list_mk_lb(path_list, type, dpo);
+ fib_path_list_mk_lb(path_list, fct, dpo);
}
/*
diff --git a/src/vnet/fib/fib_path_list.h b/src/vnet/fib/fib_path_list.h
index f4f94a1b04a..b4971addfba 100644
--- a/src/vnet/fib/fib_path_list.h
+++ b/src/vnet/fib/fib_path_list.h
@@ -61,6 +61,10 @@ typedef enum fib_path_list_attribute_t_ {
*/
FIB_PATH_LIST_ATTRIBUTE_LOOPED,
/**
+ * no uRPF - do not generate unicast RPF list for this path-list
+ */
+ FIB_PATH_LIST_ATTRIBUTE_NO_URPF,
+ /**
* Marher. Add new flags before this one, and then update it.
*/
FIB_PATH_LIST_ATTRIBUTE_LAST = FIB_PATH_LIST_ATTRIBUTE_LOOPED,
@@ -74,6 +78,7 @@ typedef enum fib_path_list_flags_t_ {
FIB_PATH_LIST_FLAG_EXCLUSIVE = (1 << FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE),
FIB_PATH_LIST_FLAG_RESOLVED = (1 << FIB_PATH_LIST_ATTRIBUTE_RESOLVED),
FIB_PATH_LIST_FLAG_LOOPED = (1 << FIB_PATH_LIST_ATTRIBUTE_LOOPED),
+ FIB_PATH_LIST_FLAG_NO_URPF = (1 << FIB_PATH_LIST_ATTRIBUTE_NO_URPF),
} fib_path_list_flags_t;
#define FIB_PATH_LIST_ATTRIBUTES { \
@@ -83,6 +88,7 @@ typedef enum fib_path_list_flags_t_ {
[FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
[FIB_PATH_LIST_ATTRIBUTE_LOCAL] = "local", \
[FIB_PATH_LIST_ATTRIBUTE_LOOPED] = "looped", \
+ [FIB_PATH_LIST_ATTRIBUTE_NO_URPF] = "no-uRPF", \
}
#define FOR_EACH_PATH_LIST_ATTRIBUTE(_item) \
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index 76db42d0ec7..57eb0ae8298 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -1043,6 +1043,26 @@ fib_table_destroy (fib_table_t *fib_table)
break;
}
}
+void
+fib_table_walk (u32 fib_index,
+ fib_protocol_t proto,
+ fib_table_walk_fn_t fn,
+ void *ctx)
+{
+ switch (proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ ip4_fib_table_walk(ip4_fib_get(fib_index), fn, ctx);
+ break;
+ case FIB_PROTOCOL_IP6:
+ ip6_fib_table_walk(fib_index, fn, ctx);
+ break;
+ case FIB_PROTOCOL_MPLS:
+ mpls_fib_table_walk(mpls_fib_get(fib_index), fn, ctx);
+ break;
+ }
+}
+
void
fib_table_unlock (u32 fib_index,
@@ -1094,11 +1114,56 @@ format_fib_table_name (u8* s, va_list ap)
return (s);
}
+/**
+ * @brief Table flush context. Store the indicies of matching FIB entries
+ * that need to be removed.
+ */
+typedef struct fib_table_flush_ctx_t_
+{
+ /**
+ * The list of entries to flush
+ */
+ fib_node_index_t *ftf_entries;
+
+ /**
+ * The source we are flushing
+ */
+ fib_source_t ftf_source;
+} fib_table_flush_ctx_t;
+
+static int
+fib_table_flush_cb (fib_node_index_t fib_entry_index,
+ void *arg)
+{
+ fib_table_flush_ctx_t *ctx = arg;
+
+ if (fib_entry_is_sourced(fib_entry_index, ctx->ftf_source))
+ {
+ vec_add1(ctx->ftf_entries, fib_entry_index);
+ }
+ return (1);
+}
+
+
void
fib_table_flush (u32 fib_index,
fib_protocol_t proto,
fib_source_t source)
{
- // FIXME
- ASSERT(0);
+ fib_node_index_t *fib_entry_index;
+ fib_table_flush_ctx_t ctx = {
+ .ftf_entries = NULL,
+ .ftf_source = source,
+ };
+
+ fib_table_walk(fib_index, proto,
+ fib_table_flush_cb,
+ &ctx);
+
+ vec_foreach(fib_entry_index, ctx.ftf_entries)
+ {
+ fib_entry_delete(*fib_entry_index, source);
+ }
+
+ vec_free(ctx.ftf_entries);
}
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index cfec516de1a..e7e66acb773 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -729,4 +729,20 @@ extern u32 fib_table_get_num_entries(u32 fib_index,
extern fib_table_t *fib_table_get(fib_node_index_t index,
fib_protocol_t proto);
+/**
+ * @brief Call back function when walking entries in a FIB table
+ */
+typedef int (*fib_table_walk_fn_t)(fib_node_index_t fei,
+ void *ctx);
+
+/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void fib_table_walk(u32 fib_index,
+ fib_protocol_t proto,
+ fib_table_walk_fn_t fn,
+ void *ctx);
+
#endif
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index 5083db26872..1c4a63a20d9 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -663,14 +663,15 @@ fib_test_v4 (void)
/*
* at this stage there are 5 entries in the test FIB (plus 5 in the default),
* all of which are special sourced and so none of which share path-lists.
- * There are also 6 entries, and 6 non-shared path-lists, in the v6 default
- * table
+ * There are also 2 entries, and 2 non-shared path-lists, in the v6 default
+ * table, and 4 path-lists in the v6 MFIB table
*/
-#define NBR (5+5+6)
+#define ENBR (5+5+2)
+#define PNBR (5+5+6)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -754,9 +755,9 @@ fib_test_v4 (void)
* +2 interface routes +2 non-shared path-lists
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NBR+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -808,9 +809,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+3 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNBR+3 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NBR+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -838,9 +839,9 @@ fib_test_v4 (void)
* -1 shared-path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NBR+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1018,9 +1019,9 @@ fib_test_v4 (void)
* +2 adj-fibs, and their non-shared path-lists
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+4 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1054,9 +1055,9 @@ fib_test_v4 (void)
* +1 entry and a shared path-list
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+5 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+5 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/* 1.1.2.0/24 */
@@ -1087,9 +1088,9 @@ fib_test_v4 (void)
* +1 entry only
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1127,9 +1128,9 @@ fib_test_v4 (void)
* +1 shared-pathlist
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1158,9 +1159,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is %d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1203,9 +1204,9 @@ fib_test_v4 (void)
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
fib_prefix_t bgp_101_pfx = {
@@ -1239,9 +1240,9 @@ fib_test_v4 (void)
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+8 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+8 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1368,9 +1369,9 @@ fib_test_v4 (void)
*/
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+10 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -1983,9 +1984,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+12 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2030,9 +2031,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+13 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+13 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2080,9 +2081,9 @@ fib_test_v4 (void)
*/
FIB_TEST((5 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+9 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+9 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+14 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+14 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2118,9 +2119,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+13 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+13 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2154,9 +2155,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+12 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2185,9 +2186,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+12 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2215,9 +2216,9 @@ fib_test_v4 (void)
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+10 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2245,9 +2246,9 @@ fib_test_v4 (void)
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+9 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+9 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2355,9 +2356,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2380,9 +2381,9 @@ fib_test_v4 (void)
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+8 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+8 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
@@ -2428,9 +2429,9 @@ fib_test_v4 (void)
*/
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+10 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
ai_03 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
@@ -2492,9 +2493,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
@@ -2562,9 +2563,9 @@ fib_test_v4 (void)
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+10 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2753,9 +2754,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -2830,9 +2831,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3180,9 +3181,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3247,9 +3248,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3297,9 +3298,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3342,9 +3343,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+7 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3438,9 +3439,9 @@ fib_test_v4 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+4 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3482,9 +3483,9 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+5 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+5 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
fib_table_entry_delete(fib_index,
@@ -3493,9 +3494,9 @@ fib_test_v4 (void)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+4 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3577,9 +3578,9 @@ fib_test_v4 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR+2 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3619,9 +3620,9 @@ fib_test_v4 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3644,11 +3645,11 @@ fib_test_v4 (void)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NBR-5 == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNBR-5 == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NBR-5 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENBR-5 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
- FIB_TEST((NBR-5 == pool_elts(fib_urpf_list_pool)), "uRPF pool size is %d",
+ FIB_TEST((ENBR-5 == pool_elts(fib_urpf_list_pool)), "uRPF pool size is %d",
pool_elts(fib_urpf_list_pool));
return 0;
@@ -3720,13 +3721,15 @@ fib_test_v6 (void)
/*
* At this stage there is one v4 FIB with 5 routes and two v6 FIBs
- * each with 6 entries. All entries are special so no path-list sharing.
+ * each with 2 entries and a v6 mfib with 4 path-lists.
+ * All entries are special so no path-list sharing.
*/
-#define NPS (5+6+6)
+#define ENPS (5+4)
+#define PNPS (5+4+4)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NPS == fib_path_list_pool_size()), "path list pool size is %d",
+ FIB_TEST((PNPS == fib_path_list_pool_size()), "path list pool size is %d",
fib_path_list_pool_size());
- FIB_TEST((NPS == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3816,9 +3819,9 @@ fib_test_v6 (void)
* +2 entries. +2 unshared path-lists
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
- FIB_TEST((NPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3862,9 +3865,9 @@ fib_test_v6 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+3 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+3 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -3890,9 +3893,9 @@ fib_test_v6 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+2 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4006,9 +4009,9 @@ fib_test_v6 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+4 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+4 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+4 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+4 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4073,9 +4076,9 @@ fib_test_v6 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+6 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4201,9 +4204,9 @@ fib_test_v6 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+6 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4275,9 +4278,9 @@ fib_test_v6 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+8 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+8 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
@@ -4401,9 +4404,9 @@ fib_test_v6 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS+8 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS+8 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4501,9 +4504,9 @@ fib_test_v6 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
/*
@@ -4513,9 +4516,9 @@ fib_test_v6 (void)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
- FIB_TEST((NPS-6 == fib_path_list_pool_size()), "path list pool size is%d",
+ FIB_TEST((PNPS-2 == fib_path_list_pool_size()), "path list pool size is%d",
fib_path_list_pool_size());
- FIB_TEST((NPS-6 == fib_entry_pool_size()), "entry pool size is %d",
+ FIB_TEST((ENPS-2 == fib_entry_pool_size()), "entry pool size is %d",
fib_entry_pool_size());
adj_unlock(ai_02);
diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c
index b66e71940a5..3ecb38e8b6c 100644
--- a/src/vnet/fib/fib_types.c
+++ b/src/vnet/fib/fib_types.c
@@ -290,8 +290,10 @@ fib_forw_chain_type_to_link_type (fib_forward_chain_type_t fct)
switch (fct)
{
case FIB_FORW_CHAIN_TYPE_UNICAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
return (VNET_LINK_IP4);
case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
return (VNET_LINK_IP6);
case FIB_FORW_CHAIN_TYPE_ETHERNET:
return (VNET_LINK_ETHERNET);
@@ -313,8 +315,10 @@ fib_forw_chain_type_to_dpo_proto (fib_forward_chain_type_t fct)
switch (fct)
{
case FIB_FORW_CHAIN_TYPE_UNICAST_IP4:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
return (DPO_PROTO_IP4);
case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
+ case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
return (DPO_PROTO_IP6);
case FIB_FORW_CHAIN_TYPE_ETHERNET:
return (DPO_PROTO_ETHERNET);
diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h
index 0a15fef1b28..c51bc9c0722 100644
--- a/src/vnet/fib/fib_types.h
+++ b/src/vnet/fib/fib_types.h
@@ -96,6 +96,14 @@ typedef enum fib_forward_chain_type_t_ {
*/
FIB_FORW_CHAIN_TYPE_MPLS_EOS,
/**
+ * Contribute an object that is to be used to forward IP4 packets
+ */
+ FIB_FORW_CHAIN_TYPE_MCAST_IP4,
+ /**
+ * Contribute an object that is to be used to forward IP6 packets
+ */
+ FIB_FORW_CHAIN_TYPE_MCAST_IP6,
+ /**
* Contribute an object that is to be used to forward Ethernet packets.
* This is last in the list since it is not valid for many FIB objects,
* and thus their array of per-chain-type DPOs can be sized smaller.
@@ -107,6 +115,8 @@ typedef enum fib_forward_chain_type_t_ {
[FIB_FORW_CHAIN_TYPE_ETHERNET] = "ethernet", \
[FIB_FORW_CHAIN_TYPE_UNICAST_IP4] = "unicast-ip4", \
[FIB_FORW_CHAIN_TYPE_UNICAST_IP6] = "unicast-ip6", \
+ [FIB_FORW_CHAIN_TYPE_MCAST_IP4] = "multicast-ip4", \
+ [FIB_FORW_CHAIN_TYPE_MCAST_IP6] = "multicast-ip6", \
[FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS] = "mpls-neos", \
[FIB_FORW_CHAIN_TYPE_MPLS_EOS] = "mpls-eos", \
}
@@ -263,6 +273,10 @@ typedef enum fib_route_path_flags_t_
* Recursion constraint of via an attahced prefix
*/
FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED = (1 << 1),
+ /**
+ * A for-us/local path
+ */
+ FIB_ROUTE_PATH_LOCAL = (1 << 2),
} fib_route_path_flags_t;
/**
diff --git a/src/vnet/fib/fib_urpf_list.c b/src/vnet/fib/fib_urpf_list.c
index 263812ade40..b484442026a 100644
--- a/src/vnet/fib/fib_urpf_list.c
+++ b/src/vnet/fib/fib_urpf_list.c
@@ -29,16 +29,24 @@ format_fib_urpf_list (u8 *s, va_list args)
u32 *swi;
ui = va_arg(args, index_t);
- urpf = fib_urpf_list_get(ui);
- s = format(s, "uPRF-list:%d len:%d itfs:[",
- ui, vec_len(urpf->furpf_itfs));
+ if (INDEX_INVALID != ui)
+ {
+ urpf = fib_urpf_list_get(ui);
+
+ s = format(s, "uPRF-list:%d len:%d itfs:[",
+ ui, vec_len(urpf->furpf_itfs));
- vec_foreach(swi, urpf->furpf_itfs)
+ vec_foreach(swi, urpf->furpf_itfs)
+ {
+ s = format(s, "%d, ", *swi);
+ }
+ s = format(s, "]");
+ }
+ else
{
- s = format(s, "%d, ", *swi);
+ s = format(s, "uRPF-list: None");
}
- s = format(s, "]");
return (s);
}
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index f6ebce00837..e8211c80d20 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -378,16 +378,13 @@ ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib,
ip4_fib_mtrie_add_del_route(fib, *addr, len, dpo->dpoi_index, 1); // DELETE
}
-static void
-ip4_fib_table_show_all (ip4_fib_t *fib,
- vlib_main_t * vm)
+void
+ip4_fib_table_walk (ip4_fib_t *fib,
+ fib_table_walk_fn_t fn,
+ void *ctx)
{
- fib_node_index_t *fib_entry_indicies;
- fib_node_index_t *fib_entry_index;
int i;
- fib_entry_indicies = NULL;
-
for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
{
uword * hash = fib->fib_entry_by_dst_address[i];
@@ -398,14 +395,45 @@ ip4_fib_table_show_all (ip4_fib_t *fib,
hash_foreach_pair (p, hash,
({
- vec_add1(fib_entry_indicies, p->value[0]);
+ fn(p->value[0], ctx);
}));
}
}
+}
+
+/**
+ * Walk show context
+ */
+typedef struct ip4_fib_show_walk_ctx_t_
+{
+ fib_node_index_t *ifsw_indicies;
+} ip4_fib_show_walk_ctx_t;
+
+static int
+ip4_fib_show_walk_cb (fib_node_index_t fib_entry_index,
+ void *arg)
+{
+ ip4_fib_show_walk_ctx_t *ctx = arg;
+
+ vec_add1(ctx->ifsw_indicies, fib_entry_index);
+
+ return (1);
+}
+
+static void
+ip4_fib_table_show_all (ip4_fib_t *fib,
+ vlib_main_t * vm)
+{
+ ip4_fib_show_walk_ctx_t ctx = {
+ .ifsw_indicies = NULL,
+ };
+ fib_node_index_t *fib_entry_index;
- vec_sort_with_function(fib_entry_indicies, fib_entry_cmp_for_sort);
+ ip4_fib_table_walk(fib, ip4_fib_show_walk_cb, &ctx);
+ vec_sort_with_function(ctx.ifsw_indicies,
+ fib_entry_cmp_for_sort);
- vec_foreach(fib_entry_index, fib_entry_indicies)
+ vec_foreach(fib_entry_index, ctx.ifsw_indicies)
{
vlib_cli_output(vm, "%U",
format_fib_entry,
@@ -413,7 +441,7 @@ ip4_fib_table_show_all (ip4_fib_t *fib,
FIB_ENTRY_FORMAT_BRIEF);
}
- vec_free(fib_entry_indicies);
+ vec_free(ctx.ifsw_indicies);
}
static void
diff --git a/src/vnet/fib/ip4_fib.h b/src/vnet/fib/ip4_fib.h
index cf312cdc629..a8dc68b5d5f 100644
--- a/src/vnet/fib/ip4_fib.h
+++ b/src/vnet/fib/ip4_fib.h
@@ -65,6 +65,15 @@ extern u32 ip4_fib_table_lookup_lb (ip4_fib_t *fib,
const ip4_address_t * dst);
/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void ip4_fib_table_walk(ip4_fib_t *fib,
+ fib_table_walk_fn_t fn,
+ void *ctx);
+
+/**
* @brief Get the FIB at the given index
*/
static inline ip4_fib_t *
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index d5b9bdcbd52..343ff55e80a 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -39,57 +39,6 @@ vnet_ip6_fib_init (u32 fib_index)
ADJ_INDEX_INVALID);
/*
- * Add ff02::1:ff00:0/104 via local route for all tables.
- * This is required for neighbor discovery to work.
- */
- ip6_set_solicited_node_multicast_address(&pfx.fp_addr.ip6, 0);
- pfx.fp_len = 104;
- fib_table_entry_special_add(fib_index,
- &pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_LOCAL,
- ADJ_INDEX_INVALID);
-
- /*
- * Add all-routers multicast address via local route for all tables
- */
- ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
- IP6_MULTICAST_SCOPE_link_local,
- IP6_MULTICAST_GROUP_ID_all_routers);
- pfx.fp_len = 128;
- fib_table_entry_special_add(fib_index,
- &pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_LOCAL,
- ADJ_INDEX_INVALID);
-
- /*
- * Add all-nodes multicast address via local route for all tables
- */
- ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
- IP6_MULTICAST_SCOPE_link_local,
- IP6_MULTICAST_GROUP_ID_all_hosts);
- pfx.fp_len = 128;
- fib_table_entry_special_add(fib_index,
- &pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_LOCAL,
- ADJ_INDEX_INVALID);
-
- /*
- * Add all-mldv2 multicast address via local route for all tables
- */
- ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
- IP6_MULTICAST_SCOPE_link_local,
- IP6_MULTICAST_GROUP_ID_mldv2_routers);
- pfx.fp_len = 128;
- fib_table_entry_special_add(fib_index,
- &pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_LOCAL,
- ADJ_INDEX_INVALID);
-
- /*
* all link local for us
*/
pfx.fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
@@ -512,27 +461,68 @@ ip6_fib_table_fwding_dpo_remove (u32 fib_index,
if (--table->dst_address_length_refcounts[len] == 0)
{
table->non_empty_dst_address_length_bitmap =
- clib_bitmap_set (table->non_empty_dst_address_length_bitmap,
+ clib_bitmap_set (table->non_empty_dst_address_length_bitmap,
128 - len, 0);
compute_prefix_lengths_in_search_order (table);
}
}
+/**
+ * @brief Context when walking the IPv6 table. Since all VRFs are in the
+ * same hash table, we need to filter only those we need as we walk
+ */
+typedef struct ip6_fib_walk_ctx_t_
+{
+ u32 i6w_fib_index;
+ fib_table_walk_fn_t i6w_fn;
+ void *i6w_ctx;
+} ip6_fib_walk_ctx_t;
+
+static int
+ip6_fib_walk_cb (clib_bihash_kv_24_8_t * kvp,
+ void *arg)
+{
+ ip6_fib_walk_ctx_t *ctx = arg;
+
+ if ((kvp->key[2] >> 32) == ctx->i6w_fib_index)
+ {
+ ctx->i6w_fn(kvp->value, ctx->i6w_ctx);
+ }
+
+ return (1);
+}
+
+void
+ip6_fib_table_walk (u32 fib_index,
+ fib_table_walk_fn_t fn,
+ void *arg)
+{
+ ip6_fib_walk_ctx_t ctx = {
+ .i6w_fib_index = fib_index,
+ .i6w_fn = fn,
+ .i6w_ctx = arg,
+ };
+ ip6_main_t *im = &ip6_main;
+
+ BV(clib_bihash_foreach_key_value_pair)(&im->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash,
+ ip6_fib_walk_cb,
+ &ctx);
+
+}
+
typedef struct ip6_fib_show_ctx_t_ {
- u32 fib_index;
fib_node_index_t *entries;
} ip6_fib_show_ctx_t;
-static void
-ip6_fib_table_collect_entries (clib_bihash_kv_24_8_t * kvp,
- void *arg)
+static int
+ip6_fib_table_show_walk (fib_node_index_t fib_entry_index,
+ void *arg)
{
ip6_fib_show_ctx_t *ctx = arg;
- if ((kvp->key[2] >> 32) == ctx->fib_index)
- {
- vec_add1(ctx->entries, kvp->value);
- }
+ vec_add1(ctx->entries, fib_entry_index);
+
+ return (1);
}
static void
@@ -541,15 +531,10 @@ ip6_fib_table_show_all (ip6_fib_t *fib,
{
fib_node_index_t *fib_entry_index;
ip6_fib_show_ctx_t ctx = {
- .fib_index = fib->index,
.entries = NULL,
};
- ip6_main_t *im = &ip6_main;
-
- BV(clib_bihash_foreach_key_value_pair)(&im->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash,
- ip6_fib_table_collect_entries,
- &ctx);
+ ip6_fib_table_walk(fib->index, ip6_fib_table_show_walk, &ctx);
vec_sort_with_function(ctx.entries, fib_entry_cmp_for_sort);
vec_foreach(fib_entry_index, ctx.entries)
diff --git a/src/vnet/fib/ip6_fib.h b/src/vnet/fib/ip6_fib.h
index f6af993a3c2..78da3746f17 100644
--- a/src/vnet/fib/ip6_fib.h
+++ b/src/vnet/fib/ip6_fib.h
@@ -54,10 +54,19 @@ u32 ip6_fib_table_fwding_lookup_with_if_index(ip6_main_t * im,
u32 sw_if_index,
const ip6_address_t * dst);
u32 ip6_fib_table_fwding_lookup(ip6_main_t * im,
- u32 fib_index,
+ u32 fib_index,
const ip6_address_t * dst);
/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void ip6_fib_table_walk(u32 fib_index,
+ fib_table_walk_fn_t fn,
+ void *ctx);
+
+/**
* @biref return the DPO that the LB stacks on.
*/
always_inline u32
diff --git a/src/vnet/fib/mpls_fib.c b/src/vnet/fib/mpls_fib.c
index 6a9b1ac2989..cc657975d0f 100644
--- a/src/vnet/fib/mpls_fib.c
+++ b/src/vnet/fib/mpls_fib.c
@@ -44,10 +44,11 @@
* Switching between schemes based on observed/measured action similarity is not
* considered on the grounds of complexity and flip-flopping.
*
- * VPP mantra - favour performance over memory. We choose a 21 bit key.
+ * VPP mantra - favour performance over memory. We choose a 21 bit key.
*/
#include <vnet/fib/fib_table.h>
+#include <vnet/fib/mpls_fib.h>
#include <vnet/dpo/load_balance.h>
#include <vnet/dpo/drop_dpo.h>
#include <vnet/dpo/punt_dpo.h>
@@ -342,6 +343,20 @@ mpls_fib_table_get_flow_hash_config (u32 fib_index)
return (0);
}
+void
+mpls_fib_table_walk (mpls_fib_t *mpls_fib,
+ fib_table_walk_fn_t fn,
+ void *ctx)
+{
+ fib_node_index_t lfei;
+ mpls_label_t key;
+
+ hash_foreach(key, lfei, mpls_fib->mf_entries,
+ ({
+ fn(lfei, ctx);
+ }));
+}
+
static void
mpls_fib_table_show_all (const mpls_fib_t *mpls_fib,
vlib_main_t * vm)
diff --git a/src/vnet/fib/mpls_fib.h b/src/vnet/fib/mpls_fib.h
index 93ae4623016..e2ef9253a9d 100644
--- a/src/vnet/fib/mpls_fib.h
+++ b/src/vnet/fib/mpls_fib.h
@@ -71,6 +71,15 @@ extern void mpls_fib_forwarding_table_reset(mpls_fib_t *mf,
mpls_eos_bit_t eos);
/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void mpls_fib_table_walk(mpls_fib_t *fib,
+ fib_table_walk_fn_t fn,
+ void *ctx);
+
+/**
* @brief
* Lookup a label and EOS bit in the MPLS_FIB table to retrieve the
* load-balance index to be used for packet forwarding.