aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vnet.am1
-rw-r--r--src/vnet/adj/adj.c12
-rw-r--r--src/vnet/adj/adj_glean.c6
-rw-r--r--src/vnet/bier/bier_api.c59
-rw-r--r--src/vnet/bier/bier_fmask.c4
-rw-r--r--src/vnet/bier/bier_test.c125
-rw-r--r--src/vnet/dpo/dpo.c53
-rw-r--r--src/vnet/dpo/dpo.h24
-rw-r--r--src/vnet/dpo/load_balance.c20
-rw-r--r--src/vnet/dpo/mpls_label_dpo.c33
-rw-r--r--src/vnet/dpo/replicate_dpo.h10
-rw-r--r--src/vnet/ethernet/arp.c2
-rw-r--r--src/vnet/fib/fib_api.c1
-rw-r--r--src/vnet/fib/fib_api.h12
-rw-r--r--src/vnet/fib/fib_attached_export.c3
-rw-r--r--src/vnet/fib/fib_entry.c187
-rw-r--r--src/vnet/fib/fib_entry.h60
-rw-r--r--src/vnet/fib/fib_entry_src.c384
-rw-r--r--src/vnet/fib/fib_entry_src.h68
-rw-r--r--src/vnet/fib/fib_entry_src_adj.c38
-rw-r--r--src/vnet/fib/fib_entry_src_interface.c35
-rw-r--r--src/vnet/fib/fib_entry_src_interpose.c370
-rw-r--r--src/vnet/fib/fib_entry_src_lisp.c4
-rw-r--r--src/vnet/fib/fib_entry_src_mpls.c126
-rw-r--r--src/vnet/fib/fib_entry_src_rr.c42
-rw-r--r--src/vnet/fib/fib_entry_src_rr.h77
-rw-r--r--src/vnet/fib/fib_path_list.c7
-rw-r--r--src/vnet/fib/fib_test.c7610
-rw-r--r--src/vnet/fib/fib_test.h1
-rw-r--r--src/vnet/fib/fib_types.api3
-rw-r--r--src/vnet/mfib/mfib_test.c417
-rw-r--r--src/vnet/udp/udp_encap.c2
32 files changed, 5453 insertions, 4343 deletions
diff --git a/src/vnet.am b/src/vnet.am
index f4a6326b560..d20124191b7 100644
--- a/src/vnet.am
+++ b/src/vnet.am
@@ -1082,6 +1082,7 @@ libvnet_la_SOURCES += \
vnet/fib/fib_entry_src.c \
vnet/fib/fib_entry_src_rr.c \
vnet/fib/fib_entry_src_interface.c \
+ vnet/fib/fib_entry_src_interpose.c \
vnet/fib/fib_entry_src_default_route.c \
vnet/fib/fib_entry_src_special.c \
vnet/fib/fib_entry_src_api.c \
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c
index 386070ed3f8..ed4bada6f24 100644
--- a/src/vnet/adj/adj.c
+++ b/src/vnet/adj/adj.c
@@ -132,13 +132,17 @@ format_ip_adjacency (u8 * s, va_list * args)
vlib_counter_t counts;
vlib_get_combined_counter(&adjacency_counters, adj_index, &counts);
- s = format (s, "\n counts:[%Ld:%Ld]", counts.packets, counts.bytes);
- s = format (s, "\n locks:%d", adj->ia_node.fn_locks);
+ s = format (s, "\n counts:[%Ld:%Ld]", counts.packets, counts.bytes);
+ s = format (s, "\n locks:%d", adj->ia_node.fn_locks);
s = format(s, "\n delegates:\n ");
adj_delegate_format(s, adj);
- s = format(s, "\n children:\n ");
- s = fib_node_children_format(adj->ia_node.fn_children, s);
+ s = format(s, "\n children:");
+ if (fib_node_list_get_size(adj->ia_node.fn_children))
+ {
+ s = format(s, "\n ");
+ s = fib_node_children_format(adj->ia_node.fn_children, s);
+ }
}
return s;
diff --git a/src/vnet/adj/adj_glean.c b/src/vnet/adj/adj_glean.c
index 7de8e397737..41bc4c9f68d 100644
--- a/src/vnet/adj/adj_glean.c
+++ b/src/vnet/adj/adj_glean.c
@@ -262,16 +262,10 @@ format_adj_glean (u8* s, va_list *ap)
{
index_t index = va_arg(*ap, index_t);
CLIB_UNUSED(u32 indent) = va_arg(*ap, u32);
- vnet_main_t * vnm = vnet_get_main();
ip_adjacency_t * adj = adj_get(index);
s = format(s, "%U-glean: %U",
format_fib_protocol, adj->ia_nh_proto,
- format_vnet_sw_interface_name,
- vnm,
- vnet_get_sw_interface(vnm,
- adj->rewrite_header.sw_if_index));
- s = format (s, " %U",
format_vnet_rewrite,
&adj->rewrite_header, sizeof (adj->rewrite_data), 0);
diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c
index 8f168c46e29..7263ec65720 100644
--- a/src/vnet/bier/bier_api.c
+++ b/src/vnet/bier/bier_api.c
@@ -49,6 +49,7 @@
#undef vl_printfun
#include <vlibapi/api_helper_macros.h>
+#include <vnet/fib/fib_api.h>
#define foreach_bier_api_msg \
_(BIER_TABLE_ADD_DEL, bier_table_add_del) \
@@ -164,7 +165,7 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
vnet_main_t *vnm;
bier_bp_t bp;
int rv = 0;
- u8 ii, jj;
+ u8 ii;
vnm = vnet_get_main ();
vnm->api_errno = 0;
@@ -195,61 +196,11 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
vec_foreach_index(ii, brpaths)
{
brpath = &brpaths[ii];
- memset(brpath, 0, sizeof(*brpath));
- brpath->frp_sw_if_index = ~0;
-
- vec_validate(brpath->frp_label_stack,
- mp->br_paths[ii].n_labels - 1);
- for (jj = 0; jj < mp->br_paths[ii].n_labels; jj++)
- {
- brpath->frp_label_stack[jj].fml_value =
- ntohl(mp->br_paths[ii].label_stack[jj].label);
- brpath->frp_label_stack[jj].fml_ttl =
- mp->br_paths[ii].label_stack[jj].ttl;
- brpath->frp_label_stack[jj].fml_exp =
- mp->br_paths[ii].label_stack[jj].exp;
- brpath->frp_label_stack[jj].fml_mode =
- (mp->br_paths[ii].label_stack[jj].is_uniform ?
- FIB_MPLS_LSP_MODE_UNIFORM :
- FIB_MPLS_LSP_MODE_PIPE);
- }
+ rv = fib_path_api_parse(&mp->br_paths[ii], brpath);
- if (mp->br_paths[ii].is_udp_encap)
+ if (0 != rv)
{
- brpath->frp_flags |= FIB_ROUTE_PATH_UDP_ENCAP;
- brpath->frp_udp_encap_id = ntohl(mp->br_paths[ii].next_hop_id);
- }
- else
- {
- if (0 == mp->br_paths[ii].afi)
- {
- clib_memcpy (&brpath->frp_addr.ip4,
- mp->br_paths[ii].next_hop,
- sizeof (brpath->frp_addr.ip4));
- }
- else
- {
- clib_memcpy (&brpath->frp_addr.ip6,
- mp->br_paths[ii].next_hop,
- sizeof (brpath->frp_addr.ip6));
- }
- if (ip46_address_is_zero(&brpath->frp_addr))
- {
- index_t bdti;
-
- bdti = bier_disp_table_find(ntohl(mp->br_paths[ii].table_id));
-
- if (INDEX_INVALID != bdti)
- {
- brpath->frp_fib_index = bdti;
- brpath->frp_proto = DPO_PROTO_BIER;
- }
- else
- {
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto done;
- }
- }
+ goto done;
}
}
diff --git a/src/vnet/bier/bier_fmask.c b/src/vnet/bier/bier_fmask.c
index 31d884af060..3d7cc838ab0 100644
--- a/src/vnet/bier/bier_fmask.c
+++ b/src/vnet/bier/bier_fmask.c
@@ -356,13 +356,13 @@ format_bier_fmask (u8 *s, va_list *ap)
{
s = format(s, " output-label:%U",
format_mpls_unicast_label,
- vnet_mpls_uc_get_label(bfm->bfm_label));
+ vnet_mpls_uc_get_label(clib_net_to_host_u32(bfm->bfm_label)));
}
else
{
s = format(s, " output-bfit:[%U]",
format_bier_bift_id,
- vnet_mpls_uc_get_label(bfm->bfm_label));
+ vnet_mpls_uc_get_label(clib_net_to_host_u32(bfm->bfm_label)));
}
s = format(s, "\n %U%U",
format_white_space, indent,
diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c
index 6c7af829811..204dafc3f0b 100644
--- a/src/vnet/bier/bier_test.c
+++ b/src/vnet/bier/bier_test.c
@@ -43,16 +43,17 @@ static int bier_test_do_debug;
if (!(_evald)) { \
fformat(stderr, "FAIL:%d: " _comment "\n", \
__LINE__, ##_args); \
+ res = 1; \
} else { \
if (bier_test_do_debug) \
fformat(stderr, "PASS:%d: " _comment "\n", \
__LINE__, ##_args); \
} \
- _evald; \
+ res; \
})
#define BIER_TEST(_cond, _comment, _args...) \
{ \
- if (!BIER_TEST_I(_cond, _comment, ##_args)) { \
+ if (BIER_TEST_I(_cond, _comment, ##_args)) { \
return 1; \
ASSERT(!("FAIL: " _comment)); \
} \
@@ -103,8 +104,10 @@ bier_test_mk_intf (u32 ninterfaces)
clib_error_t * error = NULL;
test_main_t *tm = &test_main;
u8 byte;
+ int res;
u32 i;
+ res = 0;
ASSERT(ninterfaces <= ARRAY_LEN(tm->hw_if_indicies));
for (i=0; i<6; i++)
@@ -146,13 +149,13 @@ bier_test_mk_intf (u32 ninterfaces)
tm->hw_if_indicies[i]);
}
- return (0);
+ return (res);
}
#define BIER_TEST_LB(_cond, _comment, _args...) \
{ \
- if (!BIER_TEST_I(_cond, _comment, ##_args)) { \
- return (0); \
+ if (BIER_TEST_I(_cond, _comment, ##_args)) { \
+ return (1); \
} \
}
@@ -168,13 +171,14 @@ bier_test_validate_entry (index_t bei,
va_start(ap, n_buckets);
+ res = 0;
bier_entry_contribute_forwarding(bei, &dpo);
- res = BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type),
- "Entry links to %U",
- format_dpo_type, dpo.dpoi_type);
+ BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type),
+ "Entry links to %U",
+ format_dpo_type, dpo.dpoi_type);
- if (res)
+ if (!res)
{
lb = load_balance_get(dpo.dpoi_index);
res = fib_test_validate_lb_v(lb, n_buckets, &ap);
@@ -193,7 +197,9 @@ bier_test_mpls_spf (void)
u32 mpls_fib_index;
test_main_t *tm;
int lb_count;
+ int res;
+ res = 0;
lb_count = pool_elts(load_balance_pool);
tm = &test_main;
#define N_BIER_ECMP_TABLES 16
@@ -245,24 +251,24 @@ bier_test_mpls_spf (void)
BIER_TEST(FIB_NODE_INDEX_INVALID == lfei, "1600/0 is not present");
lfei = fib_table_lookup(mpls_fib_index, &pfx_1600_eos);
- BIER_TEST(fib_test_validate_entry(lfei, FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 16,
- &l_o_bt[0],
- &l_o_bt[1],
- &l_o_bt[2],
- &l_o_bt[3],
- &l_o_bt[4],
- &l_o_bt[5],
- &l_o_bt[6],
- &l_o_bt[7],
- &l_o_bt[8],
- &l_o_bt[9],
- &l_o_bt[10],
- &l_o_bt[11],
- &l_o_bt[12],
- &l_o_bt[13],
- &l_o_bt[14],
- &l_o_bt[15]),
+ BIER_TEST(!fib_test_validate_entry(lfei, FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 16,
+ &l_o_bt[0],
+ &l_o_bt[1],
+ &l_o_bt[2],
+ &l_o_bt[3],
+ &l_o_bt[4],
+ &l_o_bt[5],
+ &l_o_bt[6],
+ &l_o_bt[7],
+ &l_o_bt[8],
+ &l_o_bt[9],
+ &l_o_bt[10],
+ &l_o_bt[11],
+ &l_o_bt[12],
+ &l_o_bt[13],
+ &l_o_bt[14],
+ &l_o_bt[15]),
"1600/1 LB stacks on BIER table %d", bti);
/*
@@ -282,24 +288,24 @@ bier_test_mpls_spf (void)
BIER_TEST(FIB_NODE_INDEX_INVALID == lfei, "1600/1 is deleted");
lfei = fib_table_lookup(mpls_fib_index, &pfx_1601_eos);
- BIER_TEST(fib_test_validate_entry(lfei, FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 16,
- &l_o_bt[0],
- &l_o_bt[1],
- &l_o_bt[2],
- &l_o_bt[3],
- &l_o_bt[4],
- &l_o_bt[5],
- &l_o_bt[6],
- &l_o_bt[7],
- &l_o_bt[8],
- &l_o_bt[9],
- &l_o_bt[10],
- &l_o_bt[11],
- &l_o_bt[12],
- &l_o_bt[13],
- &l_o_bt[14],
- &l_o_bt[15]),
+ BIER_TEST(!fib_test_validate_entry(lfei, FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 16,
+ &l_o_bt[0],
+ &l_o_bt[1],
+ &l_o_bt[2],
+ &l_o_bt[3],
+ &l_o_bt[4],
+ &l_o_bt[5],
+ &l_o_bt[6],
+ &l_o_bt[7],
+ &l_o_bt[8],
+ &l_o_bt[9],
+ &l_o_bt[10],
+ &l_o_bt[11],
+ &l_o_bt[12],
+ &l_o_bt[13],
+ &l_o_bt[14],
+ &l_o_bt[15]),
"1601/1 LB stacks on BIER table %d", bti);
/*
@@ -411,8 +417,8 @@ bier_test_mpls_spf (void)
fib_entry_contribute_forwarding(fei,
FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
&neos_dpo_1_1_1_1);
- BIER_TEST(fib_test_validate_lb(&neos_dpo_1_1_1_1, 1,
- &bucket_neos_99_via_10_10_10_1),
+ BIER_TEST(!fib_test_validate_lb(&neos_dpo_1_1_1_1, 1,
+ &bucket_neos_99_via_10_10_10_1),
"1.1.1.1/32 n-eos LB 1 buckets via: 99 + 10.10.10.1");
BIER_TEST(!dpo_cmp(&neos_dpo_1_1_1_1,
&bfm_1_1_1_1->bfm_dpo),
@@ -468,9 +474,9 @@ bier_test_mpls_spf (void)
fib_entry_contribute_forwarding(fei,
FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
&neos_dpo_1_1_1_1);
- BIER_TEST(fib_test_validate_lb(&neos_dpo_1_1_1_1, 2,
- &bucket_neos_99_via_10_10_10_1,
- &bucket_neos_100_via_10_10_10_2),
+ BIER_TEST(!fib_test_validate_lb(&neos_dpo_1_1_1_1, 2,
+ &bucket_neos_99_via_10_10_10_1,
+ &bucket_neos_100_via_10_10_10_2),
"1.1.1.1/32 n-eos LB 2 buckets "
"via: 99 + 10.10.10.1, "
"via: 100 + 10.10.10.2");
@@ -580,9 +586,9 @@ bier_test_mpls_spf (void)
input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
bier_table_route_add(&bt_0_0_0_256, 3, input_paths_1_1_1_1);
- BIER_TEST(bier_test_validate_entry(bei_3, 2,
- &dpo_o_bfm_1_1_1_1,
- &dpo_o_bfm_1_1_1_2),
+ BIER_TEST(!bier_test_validate_entry(bei_3, 2,
+ &dpo_o_bfm_1_1_1_1,
+ &dpo_o_bfm_1_1_1_2),
"BP:3 stacks on fmask 1.1.1.2 & 1.1.1.1");
/*
@@ -632,9 +638,9 @@ bier_test_mpls_spf (void)
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
- BIER_TEST(bier_test_validate_entry(bei_3, 2,
- &dpo_o_bfm_1_1_1_1,
- &dpo_o_bfm_1_1_1_2),
+ BIER_TEST(!bier_test_validate_entry(bei_3, 2,
+ &dpo_o_bfm_1_1_1_1,
+ &dpo_o_bfm_1_1_1_2),
"BP:3 stacks on fmask 1.1.1.2 & 1.1.1.1");
BIER_TEST((bier_table_fwd_lookup(bier_table_get(l_o_bt[0].bier.table), 3) ==
bfmi_1_1_1_1),
@@ -716,9 +722,7 @@ static int
bier_test_mpls_imp (void)
{
fib_node_index_t bii;
- /* test_main_t *tm; */
-
- /* tm = &test_main; */
+ int res;
/*
* Add the BIER Main table
@@ -740,6 +744,7 @@ bier_test_mpls_imp (void)
u8 buckets[BIER_HDR_BUCKETS_256];
memset(buckets, 0x5, BIER_HDR_BUCKETS_256);
+ res = 0;
bier_bit_string_init(&bbs_256, BIER_HDR_LEN_256, buckets);
bii = bier_imp_add_or_lock(&bt_0_0_0_256, 1, &bbs_256);
@@ -797,7 +802,9 @@ bier_test_mpls_disp (void)
.bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
};
index_t bti;
+ int res;
+ res = 0;
bti = bier_table_add_or_lock(&bt_0_0_0_256, 1600);
/*
diff --git a/src/vnet/dpo/dpo.c b/src/vnet/dpo/dpo.c
index 85f2c5d3622..19e3714c536 100644
--- a/src/vnet/dpo/dpo.c
+++ b/src/vnet/dpo/dpo.c
@@ -153,20 +153,22 @@ format_dpo_id (u8 * s, va_list * args)
if (NULL != dpo_vfts[dpo->dpoi_type].dv_format)
{
- return (format(s, "%U",
- dpo_vfts[dpo->dpoi_type].dv_format,
- dpo->dpoi_index,
- indent));
+ s = format(s, "%U",
+ dpo_vfts[dpo->dpoi_type].dv_format,
+ dpo->dpoi_index,
+ indent);
}
-
- switch (dpo->dpoi_type)
+ else
{
- case DPO_FIRST:
- s = format(s, "unset");
- break;
- default:
- s = format(s, "unknown");
- break;
+ switch (dpo->dpoi_type)
+ {
+ case DPO_FIRST:
+ s = format(s, "unset");
+ break;
+ default:
+ s = format(s, "unknown");
+ break;
+ }
}
return (s);
}
@@ -303,6 +305,18 @@ dpo_default_get_next_node (const dpo_id_t *dpo)
return (node_indices);
}
+/**
+ * A default variant of the make interpose function that just returns
+ * the original
+ */
+static void
+dpo_default_mk_interpose (const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone)
+{
+ dpo_copy(clone, original);
+}
+
void
dpo_register (dpo_type_t type,
const dpo_vft_t *vft,
@@ -314,6 +328,10 @@ dpo_register (dpo_type_t type,
{
dpo_vfts[type].dv_get_next_node = dpo_default_get_next_node;
}
+ if (NULL == dpo_vfts[type].dv_mk_interpose)
+ {
+ dpo_vfts[type].dv_mk_interpose = dpo_default_mk_interpose;
+ }
vec_validate(dpo_nodes, type);
dpo_nodes[type] = nodes;
@@ -331,6 +349,17 @@ dpo_register_new_type (const dpo_vft_t *vft,
}
void
+dpo_mk_interpose (const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone)
+{
+ if (!dpo_id_is_valid(original))
+ return;
+
+ dpo_vfts[original->dpoi_type].dv_mk_interpose(original, parent, clone);
+}
+
+void
dpo_lock (dpo_id_t *dpo)
{
if (!dpo_id_is_valid(dpo))
diff --git a/src/vnet/dpo/dpo.h b/src/vnet/dpo/dpo.h
index 21a2ae2a33d..0eeca67b74b 100644
--- a/src/vnet/dpo/dpo.h
+++ b/src/vnet/dpo/dpo.h
@@ -225,6 +225,14 @@ extern void dpo_lock(dpo_id_t *dpo);
extern void dpo_unlock(dpo_id_t *dpo);
/**
+ * @brief
+ * Make an interpose DPO from an original
+ */
+extern void dpo_mk_interpose(const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone);
+
+/**
* @brief Set/create a DPO ID
* The DPO will be locked.
*
@@ -374,6 +382,18 @@ typedef u32* (*dpo_get_next_node_t)(const dpo_id_t *dpo);
typedef u32 (*dpo_get_urpf_t)(const dpo_id_t *dpo);
/**
+ * @brief Called during FIB interposition when the originally
+ * registered DPO is used to 'clone' an instance for interposition
+ * at a particular location in the FIB graph.
+ * The parent is the next DPO in the chain that the clone will
+ * be used instead of. The clone may then choose to stack itself
+ * on the parent.
+ */
+typedef void (*dpo_mk_interpose_t)(const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone);
+
+/**
* @brief A virtual function table regisitered for a DPO type
*/
typedef struct dpo_vft_t_
@@ -405,6 +425,10 @@ typedef struct dpo_vft_t_
* Get uRPF interface
*/
dpo_get_urpf_t dv_get_urpf;
+ /**
+ * Signal on an interposed child that the parent has changed
+ */
+ dpo_mk_interpose_t dv_mk_interpose;
} dpo_vft_t;
diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c
index db0ebcdceb8..bb38233a55e 100644
--- a/src/vnet/dpo/load_balance.c
+++ b/src/vnet/dpo/load_balance.c
@@ -198,16 +198,6 @@ load_balance_create (u32 n_buckets,
return (load_balance_get_index(load_balance_create_i(n_buckets, lb_proto, fhc)));
}
-u16
-load_balance_n_buckets (index_t lbi)
-{
- load_balance_t *lb;
-
- lb = load_balance_get(lbi);
-
- return (lb->lb_n_buckets);
-}
-
static inline void
load_balance_set_bucket_i (load_balance_t *lb,
u32 bucket,
@@ -250,6 +240,16 @@ load_balance_is_drop (const dpo_id_t *dpo)
return (0);
}
+u16
+load_balance_n_buckets (index_t lbi)
+{
+ load_balance_t *lb;
+
+ lb = load_balance_get(lbi);
+
+ return (lb->lb_n_buckets);
+}
+
void
load_balance_set_fib_entry_flags (index_t lbi,
fib_entry_flag_t flags)
diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c
index ebbbbec9b64..0a7063cc99a 100644
--- a/src/vnet/dpo/mpls_label_dpo.c
+++ b/src/vnet/dpo/mpls_label_dpo.c
@@ -1204,11 +1204,44 @@ mpls_label_dpo_mem_show (void)
sizeof(mpls_label_dpo_t));
}
+/**
+ * Interpose a label DPO. used in the FIB unit tests
+ */
+static void
+mpls_label_interpose (const dpo_id_t *original,
+ const dpo_id_t *parent,
+ dpo_id_t *clone)
+{
+ mpls_label_dpo_t *mld, *mld_clone;
+
+ mld_clone = mpls_label_dpo_alloc();
+ mld = mpls_label_dpo_get(original->dpoi_index);
+
+ mld_clone->mld_locks = 0;
+ clib_memcpy(&mld_clone->mld_hdr,
+ &mld->mld_hdr,
+ sizeof(mld_clone->mld_hdr));
+ mld_clone->mld_payload_proto = mld->mld_payload_proto;
+ mld_clone->mld_n_labels = mld->mld_n_labels;
+ mld_clone->mld_n_hdr_bytes = mld->mld_n_hdr_bytes;
+
+ dpo_stack(mpls_label_dpo_types[MPLS_LABEL_DPO_FLAG_NONE],
+ mld_clone->mld_payload_proto,
+ &mld_clone->mld_dpo,
+ parent);
+
+ dpo_set(clone,
+ mpls_label_dpo_types[MPLS_LABEL_DPO_FLAG_NONE],
+ mld_clone->mld_payload_proto,
+ mpls_label_dpo_get_index(mld_clone));
+}
+
const static dpo_vft_t mld_vft = {
.dv_lock = mpls_label_dpo_lock,
.dv_unlock = mpls_label_dpo_unlock,
.dv_format = format_mpls_label_dpo,
.dv_mem_show = mpls_label_dpo_mem_show,
+ .dv_mk_interpose = mpls_label_interpose,
};
const static char* const mpls_label_imp_pipe_ip4_nodes[] =
diff --git a/src/vnet/dpo/replicate_dpo.h b/src/vnet/dpo/replicate_dpo.h
index 7383184a2ea..ccb25630e16 100644
--- a/src/vnet/dpo/replicate_dpo.h
+++ b/src/vnet/dpo/replicate_dpo.h
@@ -53,7 +53,7 @@ extern replicate_main_t replicate_main;
*/
typedef struct replicate_t_ {
/**
- * number of buckets in the load-balance. always a power of 2.
+ * number of buckets in the replicate.
*/
u16 rep_n_buckets;
@@ -104,15 +104,17 @@ extern void replicate_multipath_update(
load_balance_path_t *next_hops);
extern void replicate_set_bucket(index_t repi,
- u32 bucket,
- const dpo_id_t *next);
+ u32 bucket,
+ const dpo_id_t *next);
extern u8* format_replicate(u8 * s, va_list * args);
extern const dpo_id_t *replicate_get_bucket(index_t repi,
- u32 bucket);
+ u32 bucket);
extern int replicate_is_drop(const dpo_id_t *dpo);
+extern u16 replicate_n_buckets(index_t repi);
+
/**
* The encapsulation breakages are for fast DP access
*/
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c
index 4e5f867e8b1..925fb2cc6ac 100644
--- a/src/vnet/ethernet/arp.c
+++ b/src/vnet/ethernet/arp.c
@@ -979,7 +979,7 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
/*
* we're looking for FIB entries that indicate the source
* is attached. There may be more specific non-attached
- * routes tht match the source, but these do not influence
+ * routes that match the source, but these do not influence
* whether we respond to an ARP request, i.e. they do not
* influence whether we are the correct way for the sender
* to reach us, they only affect how we reach the sender.
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c
index 0c41d3cee83..e9a28658523 100644
--- a/src/vnet/fib/fib_api.c
+++ b/src/vnet/fib/fib_api.c
@@ -266,3 +266,4 @@ fib_api_path_encode (const fib_route_path_encode_t * api_rpath,
out->next_hop_id = api_rpath->rpath.frp_udp_encap_id;
}
}
+
diff --git a/src/vnet/fib/fib_api.h b/src/vnet/fib/fib_api.h
index c8b782ab156..66f0b51e891 100644
--- a/src/vnet/fib/fib_api.h
+++ b/src/vnet/fib/fib_api.h
@@ -61,4 +61,16 @@ struct _vl_api_fib_path;
extern void fib_api_path_encode (const fib_route_path_encode_t * api_rpath,
struct _vl_api_fib_path *out);
+void
+fib_prefix_to_api (const fib_prefix_t *pfx,
+ u8 address[16],
+ u8 *length,
+ u8 *is_ip6);
+
+
+struct _vl_api_fib_path;
+
+extern int fib_path_api_parse(const struct _vl_api_fib_path *in,
+ fib_route_path_t *out);
+
#endif /* __FIB_API_H__ */
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index cc8ebc8653e..3b8c6b43542 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -20,6 +20,7 @@
#include <vnet/fib/fib_entry_cover.h>
#include <vnet/fib/fib_entry_src.h>
#include <vnet/fib/fib_entry_delegate.h>
+#include <vnet/dpo/drop_dpo.h>
/**
* A description of the need to import routes from the export table
@@ -184,7 +185,7 @@ fib_entry_import_add (fib_ae_import_t *import,
dpo = fib_entry_contribute_ip_forwarding(entry_index);
- if (dpo_id_is_valid(dpo))
+ if (dpo_id_is_valid(dpo) && !dpo_is_drop(dpo))
{
fib_table_entry_special_dpo_add(import->faei_import_fib,
&prefix,
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index fed42129cff..19e84330970 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -118,8 +118,8 @@ format_fib_entry (u8 * s, va_list * args)
s = format (s, "%U", format_fib_prefix, &fib_entry->fe_prefix);
- if (level >= FIB_ENTRY_FORMAT_DETAIL)
- {
+// if (level >= FIB_ENTRY_FORMAT_DETAIL)
+// {
s = format (s, " fib:%d", fib_entry->fe_fib_index);
s = format (s, " index:%d", fib_entry_get_index(fib_entry));
s = format (s, " locks:%d", fib_entry->fe_node.fn_locks);
@@ -127,7 +127,6 @@ format_fib_entry (u8 * s, va_list * args)
FOR_EACH_SRC_ADDED(fib_entry, src, 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) {
s = format(s, " entry-flags:");
@@ -145,6 +144,7 @@ format_fib_entry (u8 * s, va_list * args)
}
}
}
+ s = fib_entry_src_format(fib_entry, source, s);
s = format (s, "\n");
if (FIB_NODE_INDEX_INVALID != src->fes_pl)
{
@@ -154,11 +154,11 @@ format_fib_entry (u8 * s, va_list * args)
}));
s = format (s, "\n forwarding: ");
- }
- else
- {
- s = format (s, "\n");
- }
+// }
+// else
+// {
+// s = format (s, "\n");
+// }
fct = fib_entry_get_default_chain_type(fib_entry);
@@ -214,6 +214,8 @@ fib_entry_last_lock_gone (fib_node_t *node)
fib_entry = fib_entry_from_fib_node(node);
+ ASSERT(!dpo_id_is_valid(&fib_entry->fe_lb));
+
FOR_EACH_DELEGATE_CHAIN(fib_entry, fdt, fed,
{
dpo_reset(&fed->fd_dpo);
@@ -223,7 +225,6 @@ fib_entry_last_lock_gone (fib_node_t *node)
FIB_ENTRY_DBG(fib_entry, "last-lock");
fib_node_deinit(&fib_entry->fe_node);
- // FIXME -RR Backwalk
ASSERT(0 == vec_len(fib_entry->fe_delegates));
vec_free(fib_entry->fe_delegates);
@@ -459,6 +460,14 @@ fib_entry_contribute_forwarding (fib_node_index_t fib_entry_index,
dpo_copy(dpo, &fed->fd_dpo);
}
/*
+ * use the drop DPO is nothing else is present
+ */
+ if (!dpo_id_is_valid(dpo))
+ {
+ dpo_copy(dpo, drop_dpo_get(fib_forw_chain_type_to_dpo_proto(fct)));
+ }
+
+ /*
* don't allow the special index indicating replicate.vs.load-balance
* to escape to the clients
*/
@@ -477,7 +486,12 @@ fib_entry_contribute_ip_forwarding (fib_node_index_t fib_entry_index)
ASSERT((fct == FIB_FORW_CHAIN_TYPE_UNICAST_IP4 ||
fct == FIB_FORW_CHAIN_TYPE_UNICAST_IP6));
- return (&fib_entry->fe_lb);
+ if (dpo_id_is_valid(&fib_entry->fe_lb))
+ {
+ return (&fib_entry->fe_lb);
+ }
+
+ return (drop_dpo_get(fib_forw_chain_type_to_dpo_proto(fct)));
}
adj_index_t
@@ -757,15 +771,26 @@ fib_entry_post_update_actions (fib_entry_t *fib_entry,
}
void
-fib_entry_source_change (fib_entry_t *fib_entry,
- fib_source_t old_source,
- fib_source_t new_source)
+fib_entry_recalculate_forwarding (fib_node_index_t fib_entry_index)
{
- fib_entry_flag_t old_flags;
+ fib_source_t best_source;
+ fib_entry_t *fib_entry;
+ fib_entry_src_t *bsrc;
- old_flags = fib_entry_get_flags_for_source(
- fib_entry_get_index(fib_entry), old_source);
+ fib_entry = fib_entry_get(fib_entry_index);
+
+ bsrc = fib_entry_get_best_src_i(fib_entry);
+ best_source = fib_entry_src_get_source(bsrc);
+
+ fib_entry_src_action_reactivate(fib_entry, best_source);
+}
+static void
+fib_entry_source_change_w_flags (fib_entry_t *fib_entry,
+ fib_source_t old_source,
+ fib_entry_flag_t old_flags,
+ fib_source_t new_source)
+{
if (new_source < old_source)
{
/*
@@ -776,11 +801,13 @@ fib_entry_source_change (fib_entry_t *fib_entry,
}
else if (new_source > old_source)
{
- /*
- * the new source loses. nothing to do here.
- * the data from the source is saved in the path-list created
- */
- return;
+ /*
+ * the new source loses. Re-activate the winning sources
+ * in case it is an interposer and hence relied on the losing
+ * source's path-list.
+ */
+ fib_entry_src_action_reactivate(fib_entry, old_source);
+ return;
}
else
{
@@ -796,6 +823,20 @@ fib_entry_source_change (fib_entry_t *fib_entry,
}
void
+fib_entry_source_change (fib_entry_t *fib_entry,
+ fib_source_t old_source,
+ fib_source_t new_source)
+{
+ fib_entry_flag_t old_flags;
+
+ old_flags = fib_entry_get_flags_for_source(
+ fib_entry_get_index(fib_entry), old_source);
+
+ return (fib_entry_source_change_w_flags(fib_entry, old_source,
+ old_flags, new_source));
+}
+
+void
fib_entry_special_add (fib_node_index_t fib_entry_index,
fib_source_t source,
fib_entry_flag_t flags,
@@ -835,7 +876,6 @@ fib_entry_path_add (fib_node_index_t fib_entry_index,
const fib_route_path_t *rpath)
{
fib_source_t best_source;
- fib_entry_flag_t bflags;
fib_entry_t *fib_entry;
fib_entry_src_t *bsrc;
@@ -846,42 +886,10 @@ fib_entry_path_add (fib_node_index_t fib_entry_index,
bsrc = fib_entry_get_best_src_i(fib_entry);
best_source = fib_entry_src_get_source(bsrc);
- bflags = fib_entry_src_get_flags(bsrc);
fib_entry = fib_entry_src_action_path_add(fib_entry, source, flags, rpath);
- /*
- * if the path list for the source passed is invalid,
- * then we need to create a new one. else we are updating
- * an existing.
- */
- if (source < best_source)
- {
- /*
- * we have a new winning source.
- */
- fib_entry_src_action_deactivate(fib_entry, best_source);
- fib_entry_src_action_activate(fib_entry, source);
- }
- else if (source > best_source)
- {
- /*
- * the new source loses. nothing to do here.
- * the data from the source is saved in the path-list created
- */
- return;
- }
- else
- {
- /*
- * the new source is one this entry already has.
- * But the path-list was updated, which will contribute new forwarding,
- * so install it.
- */
- fib_entry_src_action_reactivate(fib_entry, source);
- }
-
- fib_entry_post_update_actions(fib_entry, source, bflags);
+ fib_entry_source_change(fib_entry, best_source, source);
}
static fib_entry_src_flag_t
@@ -928,7 +936,8 @@ fib_entry_source_removed (fib_entry_t *fib_entry,
bsrc = fib_entry_get_best_src_i(fib_entry);
best_source = fib_entry_src_get_source(bsrc);
- if (FIB_SOURCE_MAX == best_source) {
+ if (FIB_SOURCE_MAX == best_source)
+ {
/*
* no more sources left. this entry is toast.
*/
@@ -1107,6 +1116,12 @@ fib_entry_special_remove (fib_node_index_t fib_entry_index,
fib_entry_src_action_uninstall(fib_entry);
return (FIB_ENTRY_SRC_FLAG_NONE);
}
+
+ /*
+ * reactivate the best source so the interposer gets restacked
+ */
+ fib_entry_src_action_reactivate(fib_entry, best_source);
+
return (FIB_ENTRY_SRC_FLAG_ADDED);
}
}
@@ -1183,48 +1198,14 @@ fib_entry_update (fib_node_index_t fib_entry_index,
bsrc = fib_entry_get_best_src_i(fib_entry);
best_source = fib_entry_src_get_source(bsrc);
- bflags = fib_entry_src_get_flags(bsrc);
-
- fib_entry_src_action_path_swap(fib_entry,
- source,
- flags,
- paths);
- /*
- * handle possible realloc's by refetching the pointer
- */
- fib_entry = fib_entry_get(fib_entry_index);
+ bflags = fib_entry_get_flags_i(fib_entry);
- /*
- * if the path list for the source passed is invalid,
- * then we need to create a new one. else we are updating
- * an existing.
- */
- if (source < best_source)
- {
- /*
- * we have a new winning source.
- */
- fib_entry_src_action_deactivate(fib_entry, best_source);
- fib_entry_src_action_activate(fib_entry, source);
- }
- else if (source > best_source) {
- /*
- * the new source loses. nothing to do here.
- * the data from the source is saved in the path-list created
- */
- return;
- }
- else
- {
- /*
- * the new source is one this entry already has.
- * But the path-list was updated, which will contribute new forwarding,
- * so install it.
- */
- fib_entry_src_action_reactivate(fib_entry, source);
- }
+ fib_entry = fib_entry_src_action_path_swap(fib_entry,
+ source,
+ flags,
+ paths);
- fib_entry_post_update_actions(fib_entry, source, bflags);
+ fib_entry_source_change_w_flags(fib_entry, best_source, bflags, source);
}
@@ -1240,7 +1221,8 @@ fib_entry_cover_changed (fib_node_index_t fib_entry_index)
.install = !0,
.bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
};
- fib_source_t source, best_source;
+ CLIB_UNUSED(fib_source_t source);
+ fib_source_t best_source;
fib_entry_flag_t bflags;
fib_entry_t *fib_entry;
fib_entry_src_t *esrc;
@@ -1263,13 +1245,13 @@ fib_entry_cover_changed (fib_node_index_t fib_entry_index)
/*
* only the best source gets to set the back walk flags
*/
- res = fib_entry_src_action_cover_change(fib_entry, source);
+ res = fib_entry_src_action_cover_change(fib_entry, esrc);
bflags = fib_entry_src_get_flags(esrc);
best_source = fib_entry_src_get_source(esrc);
}
else
{
- fib_entry_src_action_cover_change(fib_entry, source);
+ fib_entry_src_action_cover_change(fib_entry, esrc);
}
index++;
}));
@@ -1312,7 +1294,8 @@ fib_entry_cover_updated (fib_node_index_t fib_entry_index)
.install = !0,
.bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
};
- fib_source_t source, best_source;
+ CLIB_UNUSED(fib_source_t source);
+ fib_source_t best_source;
fib_entry_flag_t bflags;
fib_entry_t *fib_entry;
fib_entry_src_t *esrc;
@@ -1335,13 +1318,13 @@ fib_entry_cover_updated (fib_node_index_t fib_entry_index)
/*
* only the best source gets to set the back walk flags
*/
- res = fib_entry_src_action_cover_update(fib_entry, source);
+ res = fib_entry_src_action_cover_update(fib_entry, esrc);
bflags = fib_entry_src_get_flags(esrc);
best_source = fib_entry_src_get_source(esrc);
}
else
{
- fib_entry_src_action_cover_update(fib_entry, source);
+ fib_entry_src_action_cover_update(fib_entry, esrc);
}
index++;
}));
diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h
index 4e88314005e..92333e9cc03 100644
--- a/src/vnet/fib/fib_entry.h
+++ b/src/vnet/fib/fib_entry.h
@@ -128,9 +128,16 @@ typedef enum fib_source_t_ {
*/
FIB_SOURCE_DEFAULT_ROUTE,
/**
+ * The interpose source.
+ * This is not a real source, so don't use it to source a prefix.
+ * It exists here to provide a value against which to register to the
+ * VFT for providing the interpose actions to a real source.
+ */
+ FIB_SOURCE_INTERPOSE,
+ /**
* Marker. add new entries before this one.
*/
- FIB_SOURCE_LAST = FIB_SOURCE_DEFAULT_ROUTE,
+ FIB_SOURCE_LAST = FIB_SOURCE_INTERPOSE,
} __attribute__ ((packed)) fib_source_t;
STATIC_ASSERT (sizeof(fib_source_t) == 1,
@@ -162,6 +169,7 @@ STATIC_ASSERT (sizeof(fib_source_t) == 1,
[FIB_SOURCE_URPF_EXEMPT] = "urpf-exempt", \
[FIB_SOURCE_DEFAULT_ROUTE] = "default-route", \
[FIB_SOURCE_PLUGIN_HI] = "plugin-hi", \
+ [FIB_SOURCE_INTERPOSE] = "interpose", \
}
#define FOR_EACH_FIB_SOURCE(_item) \
@@ -223,9 +231,15 @@ typedef enum fib_entry_attribute_t_ {
*/
FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT,
/**
+ * The interpose attribute.
+ * place the forwarding provided by the source infront of the forwarding
+ * provided by the best source, or failing that, by the cover.
+ */
+ FIB_ENTRY_ATTRIBUTE_INTERPOSE,
+ /**
* Marker. add new entries before this one.
*/
- FIB_ENTRY_ATTRIBUTE_LAST = FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT,
+ FIB_ENTRY_ATTRIBUTE_LAST = FIB_ENTRY_ATTRIBUTE_INTERPOSE,
} fib_entry_attribute_t;
#define FIB_ENTRY_ATTRIBUTES { \
@@ -239,6 +253,7 @@ typedef enum fib_entry_attribute_t_ {
[FIB_ENTRY_ATTRIBUTE_MULTICAST] = "multicast", \
[FIB_ENTRY_ATTRIBUTE_NO_ATTACHED_EXPORT] = "no-attached-export", \
[FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT] = "covered-inherit", \
+ [FIB_ENTRY_ATTRIBUTE_INTERPOSE] = "interpose", \
}
#define FOR_EACH_FIB_ATTRIBUTE(_item) \
@@ -258,6 +273,7 @@ typedef enum fib_entry_flag_t_ {
FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT = (1 << FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT),
FIB_ENTRY_FLAG_MULTICAST = (1 << FIB_ENTRY_ATTRIBUTE_MULTICAST),
FIB_ENTRY_FLAG_COVERED_INHERIT = (1 << FIB_ENTRY_ATTRIBUTE_COVERED_INHERIT),
+ FIB_ENTRY_FLAG_INTERPOSE = (1 << FIB_ENTRY_ATTRIBUTE_INTERPOSE),
} __attribute__((packed)) fib_entry_flag_t;
/**
@@ -273,6 +289,10 @@ typedef enum fib_entry_src_attribute_t_ {
*/
FIB_ENTRY_SRC_ATTRIBUTE_ADDED = FIB_ENTRY_SRC_ATTRIBUTE_FIRST,
/**
+ * the source is contributing forwarding
+ */
+ FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING,
+ /**
* the source is active/best
*/
FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE,
@@ -286,22 +306,23 @@ typedef enum fib_entry_src_attribute_t_ {
FIB_ENTRY_SRC_ATTRIBUTE_LAST = FIB_ENTRY_SRC_ATTRIBUTE_INHERITED,
} fib_entry_src_attribute_t;
-#define FIB_ENTRY_SRC_ATTRIBUTE_MAX (FIB_ENTRY_SRC_ATTRIBUTE_LAST+1)
#define FIB_ENTRY_SRC_ATTRIBUTES { \
[FIB_ENTRY_SRC_ATTRIBUTE_ADDED] = "added", \
+ [FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING] = "contributing", \
[FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE] = "active", \
[FIB_ENTRY_SRC_ATTRIBUTE_INHERITED] = "inherited", \
}
#define FOR_EACH_FIB_SRC_ATTRIBUTE(_item) \
for (_item = FIB_ENTRY_SRC_ATTRIBUTE_FIRST; \
- _item < FIB_ENTRY_SRC_ATTRIBUTE_MAX; \
+ _item <= FIB_ENTRY_SRC_ATTRIBUTE_LAST; \
_item++)
typedef enum fib_entry_src_flag_t_ {
FIB_ENTRY_SRC_FLAG_NONE = 0,
FIB_ENTRY_SRC_FLAG_ADDED = (1 << FIB_ENTRY_SRC_ATTRIBUTE_ADDED),
+ FIB_ENTRY_SRC_FLAG_CONTRIBUTING = (1 << FIB_ENTRY_SRC_ATTRIBUTE_CONTRIBUTING),
FIB_ENTRY_SRC_FLAG_ACTIVE = (1 << FIB_ENTRY_SRC_ATTRIBUTE_ACTIVE),
FIB_ENTRY_SRC_FLAG_INHERITED = (1 << FIB_ENTRY_SRC_ATTRIBUTE_INHERITED),
} __attribute__ ((packed)) fib_entry_src_flag_t;
@@ -326,10 +347,17 @@ typedef struct fib_entry_src_t_ {
* The path-list created by the source
*/
fib_node_index_t fes_pl;
+
+ /**
+ * Flags the source contributes to the entry
+ */
+ fib_entry_flag_t fes_entry_flags;
+
/**
* Which source this info block is for
*/
fib_source_t fes_src;
+
/**
* Flags on the source
*/
@@ -341,11 +369,6 @@ typedef struct fib_entry_src_t_ {
* of times a given source has been added. Which is even fewer
*/
u8 fes_ref_count;
-
- /**
- * Flags the source contributes to the entry
- */
- fib_entry_flag_t fes_entry_flags;
/**
* Source specific info
@@ -365,6 +388,21 @@ typedef struct fib_entry_src_t_ {
/**
* the index of the FIB entry that is the covering entry
*/
+ fib_node_index_t fesi_cover;
+ /**
+ * This source's index in the cover's list
+ */
+ u32 fesi_sibling;
+ /**
+ * DPO type to interpose. The dpo type needs to have registered
+ * it's 'contribute interpose' callback function.
+ */
+ dpo_id_t fesi_dpo;
+ } interpose;
+ struct {
+ /**
+ * the index of the FIB entry that is the covering entry
+ */
fib_node_index_t fesa_cover;
/**
* This source's index in the cover's list
@@ -398,7 +436,7 @@ typedef struct fib_entry_src_t_ {
*/
fib_node_index_t fesl_fib_index;
} lisp;
- };
+ } u;
} fib_entry_src_t;
/**
@@ -509,6 +547,8 @@ extern void fib_entry_inherit(fib_node_index_t cover,
extern fib_entry_src_flag_t fib_entry_delete(fib_node_index_t fib_entry_index,
fib_source_t source);
+extern void fib_entry_recalculate_forwarding(
+ fib_node_index_t fib_entry_index);
extern void fib_entry_contribute_urpf(fib_node_index_t path_index,
index_t urpf);
extern void fib_entry_contribute_forwarding(
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index 0497672b268..1b2d7161060 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -29,11 +29,39 @@
*/
static fib_entry_src_vft_t fib_entry_src_vft[FIB_SOURCE_MAX];
+/**
+ * Get the VFT for a given source. This is a combination of the source
+ * enum and the interposer flags
+ */
+const fib_entry_src_vft_t*
+fib_entry_src_get_vft (const fib_entry_src_t *esrc)
+{
+ if (esrc->fes_entry_flags & FIB_ENTRY_FLAG_INTERPOSE)
+ {
+ return (&fib_entry_src_vft[FIB_SOURCE_INTERPOSE]);
+ }
+
+ return (&fib_entry_src_vft[esrc->fes_src]);
+}
+
+static void
+fib_entry_src_copy_default (const fib_entry_src_t *orig_src,
+ const fib_entry_t *fib_entry,
+ fib_entry_src_t *copy_src)
+{
+ clib_memcpy(&copy_src->u, &orig_src->u, sizeof(copy_src->u));
+}
+
void
fib_entry_src_register (fib_source_t source,
const fib_entry_src_vft_t *vft)
{
fib_entry_src_vft[source] = *vft;
+
+ if (NULL == fib_entry_src_vft[source].fesv_copy)
+ {
+ fib_entry_src_vft[source].fesv_copy = fib_entry_src_copy_default;
+ }
}
static int
@@ -45,21 +73,19 @@ fib_entry_src_cmp_for_sort (void * v1,
return (esrc1->fes_src - esrc2->fes_src);
}
-void
+static void
fib_entry_src_action_init (fib_entry_t *fib_entry,
- fib_source_t source)
-
+ fib_source_t source,
+ fib_entry_flag_t flags)
{
fib_entry_src_t esrc = {
.fes_pl = FIB_NODE_INDEX_INVALID,
.fes_flags = FIB_ENTRY_SRC_FLAG_NONE,
.fes_src = source,
+ .fes_entry_flags = flags,
};
- if (NULL != fib_entry_src_vft[source].fesv_init)
- {
- fib_entry_src_vft[source].fesv_init(&esrc);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(&esrc, fesv_init, (&esrc));
vec_add1(fib_entry->fe_srcs, esrc);
vec_sort_with_function(fib_entry->fe_srcs,
@@ -67,9 +93,9 @@ fib_entry_src_action_init (fib_entry_t *fib_entry,
}
static fib_entry_src_t *
-fib_entry_src_find (const fib_entry_t *fib_entry,
- fib_source_t source,
- u32 *index)
+fib_entry_src_find_i (const fib_entry_t *fib_entry,
+ fib_source_t source,
+ u32 *index)
{
fib_entry_src_t *esrc;
@@ -95,6 +121,14 @@ fib_entry_src_find (const fib_entry_t *fib_entry,
return (NULL);
}
+static fib_entry_src_t *
+fib_entry_src_find (const fib_entry_t *fib_entry,
+ fib_source_t source)
+
+{
+ return (fib_entry_src_find_i(fib_entry, source, NULL));
+}
+
int
fib_entry_is_sourced (fib_node_index_t fib_entry_index,
fib_source_t source)
@@ -103,26 +137,27 @@ fib_entry_is_sourced (fib_node_index_t fib_entry_index,
fib_entry = fib_entry_get(fib_entry_index);
- return (NULL != fib_entry_src_find(fib_entry, source, NULL));
+ return (NULL != fib_entry_src_find(fib_entry, source));
}
static fib_entry_src_t *
fib_entry_src_find_or_create (fib_entry_t *fib_entry,
- fib_source_t source)
+ fib_source_t source,
+ fib_entry_flag_t flags)
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL == esrc)
{
- fib_entry_src_action_init(fib_entry, source);
+ fib_entry_src_action_init(fib_entry, source, flags);
}
- return (fib_entry_src_find(fib_entry, source, NULL));
+ return (fib_entry_src_find(fib_entry, source));
}
-void
+static void
fib_entry_src_action_deinit (fib_entry_t *fib_entry,
fib_source_t source)
@@ -130,14 +165,11 @@ fib_entry_src_action_deinit (fib_entry_t *fib_entry,
fib_entry_src_t *esrc;
u32 index = ~0;
- esrc = fib_entry_src_find(fib_entry, source, &index);
+ esrc = fib_entry_src_find_i(fib_entry, source, &index);
ASSERT(NULL != esrc);
- if (NULL != fib_entry_src_vft[source].fesv_deinit)
- {
- fib_entry_src_vft[source].fesv_deinit(esrc);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deinit, (esrc));
fib_path_ext_list_flush(&esrc->fes_path_exts);
vec_del1(fib_entry->fe_srcs, index);
@@ -145,14 +177,10 @@ fib_entry_src_action_deinit (fib_entry_t *fib_entry,
fib_entry_src_cover_res_t
fib_entry_src_action_cover_change (fib_entry_t *fib_entry,
- fib_source_t source)
+ fib_entry_src_t *esrc)
{
- if (NULL != fib_entry_src_vft[source].fesv_cover_change)
- {
- return (fib_entry_src_vft[source].fesv_cover_change(
- fib_entry_src_find(fib_entry, source, NULL),
- fib_entry));
- }
+ FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, fesv_cover_change,
+ (esrc, fib_entry));
fib_entry_src_cover_res_t res = {
.install = !0,
@@ -163,14 +191,10 @@ fib_entry_src_action_cover_change (fib_entry_t *fib_entry,
fib_entry_src_cover_res_t
fib_entry_src_action_cover_update (fib_entry_t *fib_entry,
- fib_source_t source)
+ fib_entry_src_t *esrc)
{
- if (NULL != fib_entry_src_vft[source].fesv_cover_update)
- {
- return (fib_entry_src_vft[source].fesv_cover_update(
- fib_entry_src_find(fib_entry, source, NULL),
- fib_entry));
- }
+ FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, fesv_cover_update,
+ (esrc, fib_entry));
fib_entry_src_cover_res_t res = {
.install = !0,
@@ -350,8 +374,10 @@ fib_entry_src_collect_forwarding (fib_node_index_t pl_index,
{
fib_entry_src_collect_forwarding_ctx_t *ctx;
fib_path_ext_t *path_ext;
+ u32 n_nhs;
ctx = arg;
+ n_nhs = vec_len(ctx->next_hops);
/*
* if the path is not resolved, don't include it.
@@ -430,6 +456,41 @@ fib_entry_src_collect_forwarding (fib_node_index_t pl_index,
fib_entry_src_get_path_forwarding(path_index, ctx);
}
+ /*
+ * a this point 'ctx' has the DPO the path contributed, plus
+ * any labels from path extensions.
+ * check if there are any interpose sources that want to contribute
+ */
+ if (n_nhs < vec_len(ctx->next_hops))
+ {
+ /*
+ * the path contributed a new choice.
+ */
+ const fib_entry_src_vft_t *vft;
+
+ vft = fib_entry_src_get_vft(ctx->esrc);
+
+ if (NULL != vft->fesv_contribute_interpose)
+ {
+ const dpo_id_t *interposer;
+
+ interposer = vft->fesv_contribute_interpose(ctx->esrc,
+ ctx->fib_entry);
+
+ if (NULL != interposer)
+ {
+ dpo_id_t clone = DPO_INVALID;
+
+ dpo_mk_interpose(interposer,
+ &ctx->next_hops[n_nhs].path_dpo,
+ &clone);
+
+ dpo_copy(&ctx->next_hops[n_nhs].path_dpo, &clone);
+ dpo_reset(&clone);
+ }
+ }
+ }
+
return (FIB_PATH_LIST_WALK_CONTINUE);
}
@@ -585,7 +646,7 @@ fib_entry_src_action_install (fib_entry_t *fib_entry,
int insert;
fct = fib_entry_get_default_chain_type(fib_entry);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
/*
* Every entry has its own load-balance object. All changes to the entry's
@@ -660,18 +721,34 @@ fib_entry_recursive_loop_detect_i (fib_node_index_t path_list_index)
*
* copy a source data from another entry to this one
*/
-fib_entry_t *
+static fib_entry_t *
fib_entry_src_action_copy (fib_entry_t *fib_entry,
const fib_entry_src_t *orig_src)
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find_or_create(fib_entry, orig_src->fes_src);
+ esrc = fib_entry_src_find_or_create(fib_entry,
+ orig_src->fes_src,
+ orig_src->fes_entry_flags);
+
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_copy,
+ (orig_src, fib_entry, esrc));
+
+ fib_path_list_unlock(esrc->fes_pl);
+
+ /*
+ * copy over all the data ...
+ */
+ esrc->fes_flags = orig_src->fes_flags;
+ esrc->fes_pl = orig_src->fes_pl;
- *esrc = *orig_src;
+ /*
+ * ... then update
+ */
esrc->fes_ref_count = 1;
esrc->fes_flags |= FIB_ENTRY_SRC_FLAG_INHERITED;
- esrc->fes_flags &= ~FIB_ENTRY_SRC_FLAG_ACTIVE;
+ esrc->fes_flags &= ~(FIB_ENTRY_SRC_FLAG_ACTIVE |
+ FIB_ENTRY_SRC_FLAG_CONTRIBUTING);
esrc->fes_entry_flags &= ~FIB_ENTRY_FLAG_COVERED_INHERIT;
/*
@@ -694,7 +771,9 @@ fib_entry_src_action_update_from_cover (fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find_or_create(fib_entry, orig_src->fes_src);
+ esrc = fib_entry_src_find_or_create(fib_entry,
+ orig_src->fes_src,
+ orig_src->fes_entry_flags);
/*
* the source owns a lock on the entry
@@ -712,7 +791,7 @@ fib_entry_src_covered_inherit_add_i (fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, cover_src->fes_src, NULL);
+ esrc = fib_entry_src_find(fib_entry, cover_src->fes_src);
if (cover_src == esrc)
{
@@ -787,7 +866,7 @@ fib_entry_src_covered_inherit_walk_remove (fib_node_index_t fei,
fib_entry = fib_entry_get(fei);
cover_src = ctx;
- esrc = fib_entry_src_find(fib_entry, cover_src->fes_src, NULL);
+ esrc = fib_entry_src_find(fib_entry, cover_src->fes_src);
if (cover_src == esrc)
{
@@ -866,7 +945,7 @@ fib_entry_src_covered_inherit_add (fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ACTIVE);
@@ -904,19 +983,21 @@ fib_entry_src_action_activate (fib_entry_t *fib_entry,
{
int houston_we_are_go_for_install;
+ const fib_entry_src_vft_t *vft;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
ASSERT(!(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ACTIVE));
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ADDED);
- esrc->fes_flags |= FIB_ENTRY_SRC_FLAG_ACTIVE;
+ esrc->fes_flags |= (FIB_ENTRY_SRC_FLAG_ACTIVE |
+ FIB_ENTRY_SRC_FLAG_CONTRIBUTING);
+ vft = fib_entry_src_get_vft(esrc);
- if (NULL != fib_entry_src_vft[source].fesv_activate)
+ if (NULL != vft->fesv_activate)
{
- houston_we_are_go_for_install =
- fib_entry_src_vft[source].fesv_activate(esrc, fib_entry);
+ houston_we_are_go_for_install = vft->fesv_activate(esrc, fib_entry);
}
else
{
@@ -965,16 +1046,15 @@ fib_entry_src_action_deactivate (fib_entry_t *fib_entry,
fib_node_index_t path_list_index;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ACTIVE);
- if (NULL != fib_entry_src_vft[source].fesv_deactivate)
- {
- fib_entry_src_vft[source].fesv_deactivate(esrc, fib_entry);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deactivate,
+ (esrc, fib_entry));
- esrc->fes_flags &= ~FIB_ENTRY_SRC_FLAG_ACTIVE;
+ esrc->fes_flags &= ~(FIB_ENTRY_SRC_FLAG_ACTIVE |
+ FIB_ENTRY_SRC_FLAG_CONTRIBUTING);
FIB_ENTRY_DBG(fib_entry, "deactivate: %d", fib_entry->fe_parent);
@@ -1009,12 +1089,8 @@ fib_entry_src_action_fwd_update (const fib_entry_t *fib_entry,
vec_foreach(esrc, fib_entry->fe_srcs)
{
- if (NULL != fib_entry_src_vft[esrc->fes_src].fesv_fwd_update)
- {
- fib_entry_src_vft[esrc->fes_src].fesv_fwd_update(esrc,
- fib_entry,
- source);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_fwd_update,
+ (esrc, fib_entry, source));
}
}
@@ -1023,9 +1099,11 @@ fib_entry_src_action_reactivate (fib_entry_t *fib_entry,
fib_source_t source)
{
fib_node_index_t path_list_index;
+ const fib_entry_src_vft_t *vft;
fib_entry_src_t *esrc;
+ int remain_installed;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ACTIVE);
@@ -1033,10 +1111,22 @@ fib_entry_src_action_reactivate (fib_entry_t *fib_entry,
fib_entry->fe_parent,
esrc->fes_pl);
- if (fib_entry->fe_parent != esrc->fes_pl)
+ /*
+ * call the source to reactive and get the go/no-go to remain installed
+ */
+ vft = fib_entry_src_get_vft(esrc);
+
+ if (NULL != vft->fesv_reactivate)
{
- int remain_installed;
+ remain_installed = vft->fesv_reactivate(esrc, fib_entry);
+ }
+ else
+ {
+ remain_installed = 1;
+ }
+ if (fib_entry->fe_parent != esrc->fes_pl)
+ {
/*
* un-link from an old path-list. Check for any loops this will clear
*/
@@ -1072,30 +1162,19 @@ fib_entry_src_action_reactivate (fib_entry_t *fib_entry,
fib_path_list_unlock(path_list_index);
/*
- * call the source to reactive and get the go/no-go to remain installed
- */
- if (NULL != fib_entry_src_vft[source].fesv_reactivate)
- {
- remain_installed =
- fib_entry_src_vft[source].fesv_reactivate(esrc, fib_entry);
- }
- else
- {
- remain_installed = 1;
- }
-
- /*
* If this source should push its state to covered prefixs, do that now.
*/
fib_entry_src_covered_inherit_add(fib_entry, source);
+ }
- if (!remain_installed)
- {
- fib_entry_src_action_uninstall(fib_entry);
- return;
- }
+ if (!remain_installed)
+ {
+ fib_entry_src_action_uninstall(fib_entry);
+ }
+ else
+ {
+ fib_entry_src_action_install(fib_entry, source);
}
- fib_entry_src_action_install(fib_entry, source);
fib_entry_src_action_fwd_update(fib_entry, source);
}
@@ -1105,13 +1184,10 @@ fib_entry_src_action_installed (const fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
- if (NULL != fib_entry_src_vft[source].fesv_installed)
- {
- fib_entry_src_vft[source].fesv_installed(esrc,
- fib_entry);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_installed,
+ (esrc, fib_entry));
fib_entry_src_action_fwd_update(fib_entry, source);
}
@@ -1133,10 +1209,18 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
fib_node_index_t fib_entry_index;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find_or_create(fib_entry, source);
+ esrc = fib_entry_src_find_or_create(fib_entry, source, flags);
+ ASSERT(esrc->fes_ref_count < 255);
esrc->fes_ref_count++;
+ if (flags != esrc->fes_entry_flags)
+ {
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_flags_change,
+ (esrc, fib_entry, flags));
+ }
+ esrc->fes_entry_flags = flags;
+
if (1 != esrc->fes_ref_count)
{
/*
@@ -1145,21 +1229,17 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
return (fib_entry);
}
- esrc->fes_entry_flags = flags;
-
/*
* save variable so we can recover from a fib_entry realloc.
*/
fib_entry_index = fib_entry_get_index(fib_entry);
- if (NULL != fib_entry_src_vft[source].fesv_add)
- {
- fib_entry_src_vft[source].fesv_add(esrc,
- fib_entry,
- flags,
- fib_entry_get_dpo_proto(fib_entry),
- dpo);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_add,
+ (esrc,
+ fib_entry,
+ flags,
+ fib_entry_get_dpo_proto(fib_entry),
+ dpo));
fib_entry = fib_entry_get(fib_entry_index);
@@ -1192,7 +1272,7 @@ fib_entry_src_action_update (fib_entry_t *fib_entry,
fib_node_index_t fib_entry_index, old_path_list_index;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find_or_create(fib_entry, source);
+ esrc = fib_entry_src_find_or_create(fib_entry, source, flags);
if (NULL == esrc)
{
@@ -1207,14 +1287,12 @@ fib_entry_src_action_update (fib_entry_t *fib_entry,
*/
fib_entry_index = fib_entry_get_index(fib_entry);
- if (NULL != fib_entry_src_vft[source].fesv_add)
- {
- fib_entry_src_vft[source].fesv_add(esrc,
- fib_entry,
- flags,
- fib_entry_get_dpo_proto(fib_entry),
- dpo);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_add,
+ (esrc,
+ fib_entry,
+ flags,
+ fib_entry_get_dpo_proto(fib_entry),
+ dpo));
fib_entry = fib_entry_get(fib_entry_index);
@@ -1232,7 +1310,7 @@ fib_entry_src_action_remove_or_update_inherit (fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL == esrc)
return (FIB_ENTRY_SRC_FLAG_ACTIVE);
@@ -1261,7 +1339,7 @@ fib_entry_src_action_remove_or_update_inherit (fib_entry_t *fib_entry,
ASSERT(coveri != fib_entry_get_index(fib_entry));
cover = fib_entry_get(coveri);
- cover_src = fib_entry_src_find(cover, source, NULL);
+ cover_src = fib_entry_src_find(cover, source);
ASSERT(NULL != cover_src);
@@ -1290,7 +1368,7 @@ fib_entry_src_action_remove (fib_entry_t *fib_entry,
fib_entry_src_flag_t sflags;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL == esrc)
return (FIB_ENTRY_SRC_FLAG_ACTIVE);
@@ -1310,13 +1388,16 @@ fib_entry_src_action_remove (fib_entry_t *fib_entry,
{
fib_entry_src_action_deactivate(fib_entry, source);
}
+ else if (esrc->fes_flags & FIB_ENTRY_SRC_FLAG_CONTRIBUTING)
+ {
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_deactivate,
+ (esrc, fib_entry));
+ esrc->fes_flags &= ~FIB_ENTRY_SRC_FLAG_CONTRIBUTING;
+ }
old_path_list = esrc->fes_pl;
- if (NULL != fib_entry_src_vft[source].fesv_remove)
- {
- fib_entry_src_vft[source].fesv_remove(esrc);
- }
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_remove, (esrc));
fib_path_list_unlock(old_path_list);
fib_entry_unlock(fib_entry_get_index(fib_entry));
@@ -1462,7 +1543,7 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
*/
fib_entry_index = fib_entry_get_index(fib_entry);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL == esrc)
{
fib_entry =
@@ -1471,7 +1552,7 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
flags,
drop_dpo_get(
fib_entry_get_dpo_proto(fib_entry)));
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
}
/*
@@ -1482,12 +1563,13 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
*/
old_path_list = esrc->fes_pl;
- ASSERT(NULL != fib_entry_src_vft[source].fesv_path_add);
+ ASSERT(FIB_ENTRY_SRC_VFT_EXISTS(esrc, fesv_path_add));
pl_flags = fib_entry_src_flags_2_path_list_flags(fib_entry_get_flags_i(fib_entry));
fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
- fib_entry_src_vft[source].fesv_path_add(esrc, fib_entry, pl_flags, rpath);
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_add,
+ (esrc, fib_entry, pl_flags, rpath));
fib_entry = fib_entry_get(fib_entry_index);
fib_path_list_lock(esrc->fes_pl);
@@ -1508,7 +1590,7 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
fib_entry_t*
fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
fib_source_t source,
- fib_entry_flag_t flags,
+ fib_entry_flag_t flags,
const fib_route_path_t *rpaths)
{
fib_node_index_t old_path_list, fib_entry_index;
@@ -1516,7 +1598,7 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
const fib_route_path_t *rpath;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
/*
* save variable so we can recover from a fib_entry realloc.
@@ -1525,15 +1607,20 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
if (NULL == esrc)
{
- fib_entry = fib_entry_src_action_add(fib_entry,
+ fib_entry = fib_entry_src_action_add(fib_entry,
source,
flags,
drop_dpo_get(
fib_entry_get_dpo_proto(fib_entry)));
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
}
else
{
+ if (flags != esrc->fes_entry_flags)
+ {
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_flags_change,
+ (esrc, fib_entry, flags));
+ }
esrc->fes_entry_flags = flags;
}
@@ -1544,7 +1631,7 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
*/
old_path_list = esrc->fes_pl;
- ASSERT(NULL != fib_entry_src_vft[source].fesv_path_swap);
+ ASSERT(FIB_ENTRY_SRC_VFT_EXISTS(esrc, fesv_path_swap));
pl_flags = fib_entry_src_flags_2_path_list_flags(flags);
@@ -1553,10 +1640,9 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
}
- fib_entry_src_vft[source].fesv_path_swap(esrc,
- fib_entry,
- pl_flags,
- rpaths);
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_swap,
+ (esrc, fib_entry,
+ pl_flags, rpaths));
fib_entry = fib_entry_get(fib_entry_index);
@@ -1575,7 +1661,7 @@ fib_entry_src_action_path_remove (fib_entry_t *fib_entry,
fib_node_index_t old_path_list;
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
ASSERT(NULL != esrc);
ASSERT(esrc->fes_flags & FIB_ENTRY_SRC_FLAG_ADDED);
@@ -1588,12 +1674,13 @@ fib_entry_src_action_path_remove (fib_entry_t *fib_entry,
*/
old_path_list = esrc->fes_pl;
- ASSERT(NULL != fib_entry_src_vft[source].fesv_path_remove);
+ ASSERT(FIB_ENTRY_SRC_VFT_EXISTS(esrc, fesv_path_remove));
pl_flags = fib_entry_src_flags_2_path_list_flags(fib_entry_get_flags_i(fib_entry));
fib_entry_flags_update(fib_entry, rpath, &pl_flags, esrc);
- fib_entry_src_vft[source].fesv_path_remove(esrc, pl_flags, rpath);
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_path_remove,
+ (esrc, pl_flags, rpath));
/*
* lock the new path-list, unlock the old if it had one
@@ -1621,12 +1708,10 @@ fib_entry_src_format (fib_entry_t *fib_entry,
{
fib_entry_src_t *esrc;
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
+
+ FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, fesv_format, (esrc, s));
- if (NULL != fib_entry_src_vft[source].fesv_format)
- {
- return (fib_entry_src_vft[source].fesv_format(esrc, s));
- }
return (s);
}
@@ -1641,7 +1726,7 @@ fib_entry_get_adj_for_source (fib_node_index_t fib_entry_index,
return (ADJ_INDEX_INVALID);
fib_entry = fib_entry_get(fib_entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL != esrc)
{
@@ -1667,7 +1752,7 @@ fib_entry_get_dpo_for_source (fib_node_index_t fib_entry_index,
return (0);
fib_entry = fib_entry_get(fib_entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL != esrc)
{
@@ -1694,7 +1779,7 @@ fib_entry_get_resolving_interface_for_source (fib_node_index_t entry_index,
fib_entry = fib_entry_get(entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL != esrc)
{
@@ -1715,7 +1800,7 @@ fib_entry_get_flags_for_source (fib_node_index_t entry_index,
fib_entry = fib_entry_get(entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
if (NULL != esrc)
{
@@ -1757,12 +1842,12 @@ fib_entry_set_source_data (fib_node_index_t fib_entry_index,
fib_entry_src_t *esrc;
fib_entry = fib_entry_get(fib_entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
- if (NULL != esrc &&
- NULL != fib_entry_src_vft[source].fesv_set_data)
+ if (NULL != esrc)
{
- fib_entry_src_vft[source].fesv_set_data(esrc, fib_entry, data);
+ FIB_ENTRY_SRC_VFT_INVOKE(esrc, fesv_set_data,
+ (esrc, fib_entry, data));
}
}
@@ -1774,12 +1859,12 @@ fib_entry_get_source_data (fib_node_index_t fib_entry_index,
fib_entry_src_t *esrc;
fib_entry = fib_entry_get(fib_entry_index);
- esrc = fib_entry_src_find(fib_entry, source, NULL);
+ esrc = fib_entry_src_find(fib_entry, source);
- if (NULL != esrc &&
- NULL != fib_entry_src_vft[source].fesv_get_data)
+ if (NULL != esrc)
{
- return (fib_entry_src_vft[source].fesv_get_data(esrc, fib_entry));
+ FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, fesv_get_data,
+ (esrc, fib_entry));
}
return (NULL);
}
@@ -1789,6 +1874,7 @@ fib_entry_src_module_init (void)
{
fib_entry_src_rr_register();
fib_entry_src_interface_register();
+ fib_entry_src_interpose_register();
fib_entry_src_default_route_register();
fib_entry_src_special_register();
fib_entry_src_api_register();
diff --git a/src/vnet/fib/fib_entry_src.h b/src/vnet/fib/fib_entry_src.h
index 57840d555ee..61740201eb7 100644
--- a/src/vnet/fib/fib_entry_src.h
+++ b/src/vnet/fib/fib_entry_src.h
@@ -173,6 +173,26 @@ typedef const void* (*fib_entry_src_get_data_t)(fib_entry_src_t *src,
const fib_entry_t *fib_entry);
/**
+ * Contribute forwarding to interpose inthe chain
+ */
+typedef const dpo_id_t* (*fib_entry_src_contribute_interpose_t)(const fib_entry_src_t *src,
+ const fib_entry_t *fib_entry);
+
+/**
+ * The fib entry flags for this source are changing
+ */
+typedef void (*fib_entry_src_flag_change_t)(fib_entry_src_t *src,
+ const fib_entry_t *fib_entry,
+ fib_entry_flag_t new_flags);
+
+/**
+ * The fib entry flags for this source are changing
+ */
+typedef void (*fib_entry_src_copy_t)(const fib_entry_src_t *orig_src,
+ const fib_entry_t *fib_entry,
+ fib_entry_src_t *copy_src);
+
+/**
* Virtual function table each FIB entry source will register
*/
typedef struct fib_entry_src_vft_t_ {
@@ -193,21 +213,48 @@ typedef struct fib_entry_src_vft_t_ {
fib_entry_src_fwd_update_t fesv_fwd_update;
fib_entry_src_get_data_t fesv_get_data;
fib_entry_src_set_data_t fesv_set_data;
+ fib_entry_src_contribute_interpose_t fesv_contribute_interpose;
+ fib_entry_src_flag_change_t fesv_flags_change;
+ fib_entry_src_copy_t fesv_copy;
} fib_entry_src_vft_t;
#define FOR_EACH_SRC_ADDED(_entry, _src, _source, action) \
{ \
- vec_foreach(_src, _entry->fe_srcs) \
+ vec_foreach(_src, (_entry)->fe_srcs) \
{ \
if (_src->fes_flags & FIB_ENTRY_SRC_FLAG_ADDED) { \
- _source = _src->fes_src; \
- do { \
- action; \
- } while(0); \
+ _source = (_src)->fes_src; \
+ action; \
} \
} \
}
+#define FIB_ENTRY_SRC_VFT_INVOKE(esrc, func, args) \
+{ \
+ const fib_entry_src_vft_t *_vft; \
+ _vft = fib_entry_src_get_vft(esrc); \
+ if (_vft->func) \
+ _vft->func args; \
+}
+
+#define FIB_ENTRY_SRC_VFT_INVOKE_AND_RETURN(esrc, func, args) \
+{ \
+ const fib_entry_src_vft_t *_vft; \
+ _vft = fib_entry_src_get_vft(esrc); \
+ if (_vft->func) \
+ return (_vft->func args); \
+}
+
+#define FIB_ENTRY_SRC_VFT_EXISTS(esrc, func) \
+{ \
+ const fib_entry_src_vft_t *_vft; \
+ _vft = fib_entry_src_get_vft(esrc); \
+ (_vft->func); \
+}
+
+extern const fib_entry_src_vft_t*fib_entry_src_get_vft(
+ const fib_entry_src_t *esrc);
+
extern u8* fib_entry_src_format(fib_entry_t *entry,
fib_source_t source,
u8* s);
@@ -215,19 +262,13 @@ extern u8* fib_entry_src_format(fib_entry_t *entry,
extern void fib_entry_src_register(fib_source_t source,
const fib_entry_src_vft_t *vft);
-extern void fib_entry_src_action_init(fib_entry_t *entry,
- fib_source_t source);
-
-extern void fib_entry_src_action_deinit(fib_entry_t *fib_entry,
- fib_source_t source);
-
extern fib_entry_src_cover_res_t fib_entry_src_action_cover_change(
fib_entry_t *entry,
- fib_source_t source);
+ fib_entry_src_t *esrc);
extern fib_entry_src_cover_res_t fib_entry_src_action_cover_update(
fib_entry_t *fib_entry,
- fib_source_t source);
+ fib_entry_src_t *esrc);
extern void fib_entry_src_action_activate(fib_entry_t *fib_entry,
fib_source_t source);
@@ -304,6 +345,7 @@ extern void fib_entry_source_change(fib_entry_t *fib_entry,
extern void fib_entry_src_default_register(void);
extern void fib_entry_src_rr_register(void);
extern void fib_entry_src_interface_register(void);
+extern void fib_entry_src_interpose_register(void);
extern void fib_entry_src_default_route_register(void);
extern void fib_entry_src_special_register(void);
extern void fib_entry_src_api_register(void);
diff --git a/src/vnet/fib/fib_entry_src_adj.c b/src/vnet/fib/fib_entry_src_adj.c
index 04c5c8dc1f7..e43e36ee4e5 100644
--- a/src/vnet/fib/fib_entry_src_adj.c
+++ b/src/vnet/fib/fib_entry_src_adj.c
@@ -27,8 +27,8 @@
static void
fib_entry_src_adj_init (fib_entry_src_t *src)
{
- src->adj.fesa_cover = FIB_NODE_INDEX_INVALID;
- src->adj.fesa_sibling = FIB_NODE_INDEX_INVALID;
+ src->u.adj.fesa_cover = FIB_NODE_INDEX_INVALID;
+ src->u.adj.fesa_sibling = FIB_NODE_INDEX_INVALID;
}
static void
@@ -211,17 +211,17 @@ fib_entry_src_adj_activate (fib_entry_src_t *src,
* find the covering prefix. become a dependent thereof.
* there should always be a cover, though it may be the default route.
*/
- src->adj.fesa_cover = fib_table_get_less_specific(fib_entry->fe_fib_index,
- &fib_entry->fe_prefix);
+ src->u.adj.fesa_cover = fib_table_get_less_specific(fib_entry->fe_fib_index,
+ &fib_entry->fe_prefix);
- ASSERT(FIB_NODE_INDEX_INVALID != src->adj.fesa_cover);
- ASSERT(fib_entry_get_index(fib_entry) != src->adj.fesa_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.adj.fesa_cover);
+ ASSERT(fib_entry_get_index(fib_entry) != src->u.adj.fesa_cover);
- cover = fib_entry_get(src->adj.fesa_cover);
+ cover = fib_entry_get(src->u.adj.fesa_cover);
ASSERT(cover != fib_entry);
- src->adj.fesa_sibling =
+ src->u.adj.fesa_sibling =
fib_entry_cover_track(cover,
fib_entry_get_index(fib_entry));
@@ -240,7 +240,7 @@ fib_entry_src_adj_activate (fib_entry_src_t *src,
if (FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags_i(cover))
{
fib_entry_src_path_list_walk_cxt_t ctx = {
- .cover_itf = fib_entry_get_resolving_interface(src->adj.fesa_cover),
+ .cover_itf = fib_entry_get_resolving_interface(src->u.adj.fesa_cover),
.flags = FIB_PATH_EXT_ADJ_FLAG_NONE,
.src = src,
};
@@ -267,7 +267,7 @@ fib_entry_src_adj_reactivate (fib_entry_src_t *src,
const fib_entry_t *fib_entry)
{
fib_entry_src_path_list_walk_cxt_t ctx = {
- .cover_itf = fib_entry_get_resolving_interface(src->adj.fesa_cover),
+ .cover_itf = fib_entry_get_resolving_interface(src->u.adj.fesa_cover),
.flags = FIB_PATH_EXT_ADJ_FLAG_NONE,
.src = src,
};
@@ -292,24 +292,24 @@ fib_entry_src_adj_deactivate (fib_entry_src_t *src,
/*
* remove the depednecy on the covering entry
*/
- ASSERT(FIB_NODE_INDEX_INVALID != src->adj.fesa_cover);
- cover = fib_entry_get(src->adj.fesa_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.adj.fesa_cover);
+ cover = fib_entry_get(src->u.adj.fesa_cover);
- fib_entry_cover_untrack(cover, src->adj.fesa_sibling);
+ fib_entry_cover_untrack(cover, src->u.adj.fesa_sibling);
/*
* tell the cover this entry no longer needs exporting
*/
fib_attached_export_covered_removed(cover, fib_entry_get_index(fib_entry));
- src->adj.fesa_cover = FIB_NODE_INDEX_INVALID;
+ src->u.adj.fesa_cover = FIB_NODE_INDEX_INVALID;
}
static u8*
fib_entry_src_adj_format (fib_entry_src_t *src,
u8* s)
{
- return (format(s, " cover:%d", src->adj.fesa_cover));
+ return (format(s, " cover:%d", src->u.adj.fesa_cover));
}
static void
@@ -321,8 +321,8 @@ fib_entry_src_adj_installed (fib_entry_src_t *src,
*/
fib_entry_t *cover;
- ASSERT(FIB_NODE_INDEX_INVALID != src->adj.fesa_cover);
- cover = fib_entry_get(src->adj.fesa_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.adj.fesa_cover);
+ cover = fib_entry_get(src->u.adj.fesa_cover);
fib_attached_export_covered_added(cover,
fib_entry_get_index(fib_entry));
@@ -369,9 +369,9 @@ fib_entry_src_adj_cover_update (fib_entry_src_t *src,
};
fib_entry_t *cover;
- ASSERT(FIB_NODE_INDEX_INVALID != src->adj.fesa_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.adj.fesa_cover);
- cover = fib_entry_get(src->adj.fesa_cover);
+ cover = fib_entry_get(src->u.adj.fesa_cover);
res.install = (FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags_i(cover));
diff --git a/src/vnet/fib/fib_entry_src_interface.c b/src/vnet/fib/fib_entry_src_interface.c
index f79be72c45a..4ce4f14ab4e 100644
--- a/src/vnet/fib/fib_entry_src_interface.c
+++ b/src/vnet/fib/fib_entry_src_interface.c
@@ -27,8 +27,8 @@
static void
fib_entry_src_interface_init (fib_entry_src_t *src)
{
- src->interface.fesi_cover = FIB_NODE_INDEX_INVALID;
- src->interface.fesi_sibling = FIB_NODE_INDEX_INVALID;
+ src->u.interface.fesi_cover = FIB_NODE_INDEX_INVALID;
+ src->u.interface.fesi_sibling = FIB_NODE_INDEX_INVALID;
}
static void
@@ -74,7 +74,7 @@ fib_entry_src_interface_path_swap (fib_entry_src_t *src,
{
/*
* the connected prefix will link to a glean on a non-p2p
- * interface.
+ * u.interface.
*/
adj->sub_type.glean.receive_addr = entry->fe_prefix.fp_addr;
}
@@ -98,15 +98,15 @@ fib_entry_src_interface_activate (fib_entry_src_t *src,
* during an attached export of the cover, this local prefix is
* also exported
*/
- src->interface.fesi_cover =
+ src->u.interface.fesi_cover =
fib_table_get_less_specific(fib_entry->fe_fib_index,
&fib_entry->fe_prefix);
- ASSERT(FIB_NODE_INDEX_INVALID != src->interface.fesi_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.interface.fesi_cover);
- cover = fib_entry_get(src->interface.fesi_cover);
+ cover = fib_entry_get(src->u.interface.fesi_cover);
- src->interface.fesi_sibling =
+ src->u.interface.fesi_sibling =
fib_entry_cover_track(cover, fib_entry_get_index(fib_entry));
}
@@ -127,13 +127,13 @@ fib_entry_src_interface_deactivate (fib_entry_src_t *src,
/*
* remove the depednecy on the covering entry
*/
- if (FIB_NODE_INDEX_INVALID != src->interface.fesi_cover)
+ if (FIB_NODE_INDEX_INVALID != src->u.interface.fesi_cover)
{
- cover = fib_entry_get(src->interface.fesi_cover);
+ cover = fib_entry_get(src->u.interface.fesi_cover);
- fib_entry_cover_untrack(cover, src->interface.fesi_sibling);
+ fib_entry_cover_untrack(cover, src->u.interface.fesi_sibling);
- src->interface.fesi_cover = FIB_NODE_INDEX_INVALID;
+ src->u.interface.fesi_cover = FIB_NODE_INDEX_INVALID;
}
}
@@ -146,7 +146,7 @@ fib_entry_src_interface_cover_change (fib_entry_src_t *src,
.bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
};
- if (FIB_NODE_INDEX_INVALID == src->interface.fesi_cover)
+ if (FIB_NODE_INDEX_INVALID == src->u.interface.fesi_cover)
{
/*
* not tracking the cover. surprised we got poked?
@@ -159,8 +159,9 @@ fib_entry_src_interface_cover_change (fib_entry_src_t *src,
* entry inserted benaeth it. That does not necessarily mean that this
* entry is covered by the new prefix. check that
*/
- if (src->rr.fesr_cover != fib_table_get_less_specific(fib_entry->fe_fib_index,
- &fib_entry->fe_prefix))
+ if (src->u.interface.fesi_cover !=
+ fib_table_get_less_specific(fib_entry->fe_fib_index,
+ &fib_entry->fe_prefix))
{
fib_entry_src_interface_deactivate(src, fib_entry);
fib_entry_src_interface_activate(src, fib_entry);
@@ -177,9 +178,9 @@ fib_entry_src_interface_installed (fib_entry_src_t *src,
*/
fib_entry_t *cover;
- if (FIB_NODE_INDEX_INVALID != src->interface.fesi_cover)
+ if (FIB_NODE_INDEX_INVALID != src->u.interface.fesi_cover)
{
- cover = fib_entry_get(src->interface.fesi_cover);
+ cover = fib_entry_get(src->u.interface.fesi_cover);
fib_attached_export_covered_added(cover,
fib_entry_get_index(fib_entry));
@@ -190,7 +191,7 @@ static u8*
fib_entry_src_interface_format (fib_entry_src_t *src,
u8* s)
{
- return (format(s, " cover:%d", src->interface.fesi_cover));
+ return (format(s, " cover:%d", src->u.interface.fesi_cover));
}
const static fib_entry_src_vft_t interface_src_vft = {
diff --git a/src/vnet/fib/fib_entry_src_interpose.c b/src/vnet/fib/fib_entry_src_interpose.c
new file mode 100644
index 00000000000..c362328f473
--- /dev/null
+++ b/src/vnet/fib/fib_entry_src_interpose.c
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vlib/vlib.h>
+#include <vnet/ip/format.h>
+#include <vnet/ip/lookup.h>
+#include <vnet/adj/adj.h>
+#include <vnet/dpo/drop_dpo.h>
+
+#include "fib_entry_src.h"
+#include "fib_entry_src_rr.h"
+#include "fib_entry_cover.h"
+#include "fib_entry.h"
+#include "fib_table.h"
+
+/*
+ * Source initialisation Function
+ */
+static void
+fib_entry_src_interpose_init (fib_entry_src_t *src)
+{
+ src->u.interpose.fesi_cover = FIB_NODE_INDEX_INVALID;
+ src->u.interpose.fesi_sibling = FIB_NODE_INDEX_INVALID;
+}
+
+/*
+ * Source deinitialisation Function
+ */
+static void
+fib_entry_src_interpose_deinit (fib_entry_src_t *src)
+{
+ ASSERT(src->u.interpose.fesi_cover == FIB_NODE_INDEX_INVALID);
+
+ src->u.interpose.fesi_cover = FIB_NODE_INDEX_INVALID;
+ src->u.interpose.fesi_sibling = FIB_NODE_INDEX_INVALID;
+
+ dpo_reset(&src->u.interpose.fesi_dpo);
+}
+
+static fib_entry_src_t *
+fib_entry_src_rr_get_next_best (const fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ fib_entry_src_t *next_src, *best_src = NULL;
+ fib_source_t source;
+
+ FOR_EACH_SRC_ADDED(fib_entry, next_src, source,
+ ({
+ /*
+ * skip to the next best source after this one
+ */
+ if (source <= src->fes_src)
+ {
+ continue;
+ }
+ else
+ {
+ best_src = next_src;
+ break;
+ }
+ }));
+
+ return (best_src);
+}
+
+/*
+ * Source activation. Called when the source is the new best source on the entry
+ */
+static int
+fib_entry_src_interpose_activate (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ fib_entry_src_t *best_src;
+ fib_node_index_t old_pl;
+ fib_entry_t *cover;
+
+ old_pl = src->fes_pl;
+ src->fes_pl = FIB_NODE_INDEX_INVALID;
+
+ /*
+ * The goal here is to find a path-list that will contribute forwarding
+ * for the entry.
+ * First check this entry for other sources that have a path-list
+ */
+ best_src = fib_entry_src_rr_get_next_best(src, fib_entry);
+
+ if (NULL != best_src)
+ {
+ const fib_entry_src_vft_t *vft;
+
+ best_src->fes_flags |= FIB_ENTRY_SRC_FLAG_CONTRIBUTING;
+ vft = fib_entry_src_get_vft(best_src);
+ /*
+ * there is another source for this entry. activate it so it
+ * can provide forwarding
+ */
+ if (NULL != vft->fesv_activate)
+ {
+ if (vft->fesv_activate(best_src, fib_entry))
+ {
+ /*
+ * next best source activated ok, use its path list
+ */
+ src->fes_pl = best_src->fes_pl;
+ }
+ }
+ else
+ {
+ /*
+ * next best source does not require activation, use its path list
+ */
+ src->fes_pl = best_src->fes_pl;
+ }
+ }
+ else
+ {
+ /*
+ * find the covering prefix. become a dependent thereof.
+ * for IP there should always be a cover, though it may be the default route.
+ * For MPLS there is never a cover.
+ */
+ if (FIB_PROTOCOL_MPLS == fib_entry->fe_prefix.fp_proto)
+ {
+ src->fes_pl = fib_path_list_create_special(DPO_PROTO_MPLS,
+ FIB_PATH_LIST_FLAG_DROP,
+ NULL);
+ }
+ else
+ {
+ src->u.interpose.fesi_cover =
+ fib_table_get_less_specific(fib_entry->fe_fib_index,
+ &fib_entry->fe_prefix);
+
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.interpose.fesi_cover);
+
+ cover = fib_entry_get(src->u.interpose.fesi_cover);
+
+ src->u.interpose.fesi_sibling =
+ fib_entry_cover_track(cover, fib_entry_get_index(fib_entry));
+
+ /*
+ * if the cover is attached then install an attached-host path
+ * (like an adj-fib). Otherwise inherit the forwarding from the cover
+ */
+ if (FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags_i(cover))
+ {
+ fib_entry_src_rr_resolve_via_connected(src, fib_entry, cover);
+ }
+ else
+ {
+ fib_entry_src_rr_use_covers_pl(src, fib_entry, cover);
+ }
+ }
+ }
+
+ fib_path_list_unlock(old_pl);
+ fib_path_list_lock(src->fes_pl);
+
+ /*
+ * return go for install
+ */
+ return (!0);
+}
+
+/**
+ * Source Deactivate.
+ * Called when the source is no longer best source on the entry
+ */
+static void
+fib_entry_src_interpose_deactivate (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ fib_entry_t *cover;
+
+ if (FIB_NODE_INDEX_INVALID != src->u.interpose.fesi_cover)
+ {
+ /*
+ * remove the depednecy on the covering entry, if that's
+ * what was contributing the path-list
+ */
+ cover = fib_entry_get(src->u.interpose.fesi_cover);
+ fib_entry_cover_untrack(cover, src->u.interpose.fesi_sibling);
+ src->u.interpose.fesi_cover = FIB_NODE_INDEX_INVALID;
+ }
+ else
+ {
+ fib_entry_src_t *best_src;
+
+ best_src = fib_entry_src_rr_get_next_best(src, fib_entry);
+
+ if (best_src)
+ {
+ best_src->fes_flags &= ~FIB_ENTRY_SRC_FLAG_CONTRIBUTING;
+ /*
+ * there is another source for this entry. activate it so it
+ * can provide forwarding
+ */
+ FIB_ENTRY_SRC_VFT_INVOKE(best_src, fesv_deactivate,
+ (best_src, fib_entry));
+ }
+ }
+
+ fib_path_list_unlock(src->fes_pl);
+ src->fes_pl = FIB_NODE_INDEX_INVALID;
+ src->fes_entry_flags &= ~FIB_ENTRY_FLAGS_RR_INHERITED;
+}
+
+static int
+fib_entry_src_interpose_reactivate (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ fib_entry_src_interpose_deactivate(src, fib_entry);
+ return (fib_entry_src_interpose_activate(src, fib_entry));
+}
+
+static fib_entry_src_cover_res_t
+fib_entry_src_interpose_cover_change (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ fib_entry_src_cover_res_t res = {
+ .install = !0,
+ .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
+ };
+
+ if (FIB_NODE_INDEX_INVALID == src->u.interpose.fesi_cover)
+ {
+ /*
+ * the source may be added, but it is not active
+ * if it is not tracking the cover.
+ */
+ return (res);
+ }
+
+ /*
+ * this function is called when this entry's cover has a more specific
+ * entry inserted benaeth it. That does not necessarily mean that this
+ * entry is covered by the new prefix. check that
+ */
+ if (src->u.interpose.fesi_cover !=
+ fib_table_get_less_specific(fib_entry->fe_fib_index,
+ &fib_entry->fe_prefix))
+ {
+ fib_entry_src_interpose_deactivate(src, fib_entry);
+ fib_entry_src_interpose_activate(src, fib_entry);
+
+ /*
+ * dependent children need to re-resolve to the new forwarding info
+ */
+ res.bw_reason = FIB_NODE_BW_REASON_FLAG_EVALUATE;
+ }
+ return (res);
+}
+
+static void
+fib_entry_src_interpose_add (fib_entry_src_t *src,
+ const fib_entry_t *entry,
+ fib_entry_flag_t flags,
+ dpo_proto_t proto,
+ const dpo_id_t *dpo)
+{
+ dpo_copy(&src->u.interpose.fesi_dpo, dpo);
+}
+
+static void
+fib_entry_src_interpose_remove (fib_entry_src_t *src)
+{
+ dpo_reset(&src->u.interpose.fesi_dpo);
+}
+
+static void
+fib_entry_src_interpose_set_data (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry,
+ const void *data)
+{
+ const dpo_id_t *dpo = data;
+
+ dpo_copy(&src->u.interpose.fesi_dpo, dpo);
+}
+
+/**
+ * Contribute forwarding to interpose in the chain
+ */
+const dpo_id_t* fib_entry_src_interpose_contribute(const fib_entry_src_t *src,
+ const fib_entry_t *fib_entry)
+{
+ return (&src->u.interpose.fesi_dpo);
+}
+
+static void
+fib_entry_src_interpose_copy (const fib_entry_src_t *orig_src,
+ const fib_entry_t *fib_entry,
+ fib_entry_src_t *copy_src)
+{
+ copy_src->u.interpose.fesi_cover = orig_src->u.interpose.fesi_cover;
+
+ if (FIB_NODE_INDEX_INVALID != copy_src->u.interpose.fesi_cover)
+ {
+ fib_entry_t *cover;
+
+ cover = fib_entry_get(orig_src->u.interpose.fesi_cover);
+ copy_src->u.interpose.fesi_sibling =
+ fib_entry_cover_track(cover, fib_entry_get_index(fib_entry));
+ }
+
+ dpo_copy(&copy_src->u.interpose.fesi_dpo,
+ &orig_src->u.interpose.fesi_dpo);
+}
+
+static void
+fib_entry_src_interpose_flag_change (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry,
+ fib_entry_flag_t new_flags)
+{
+ if (!(new_flags & FIB_ENTRY_FLAG_INTERPOSE))
+ {
+ /*
+ * stop tracking the source contributing forwarding
+ * and reset the interposer DPO
+ */
+ fib_entry_src_interpose_deactivate(src, fib_entry);
+ fib_entry_src_interpose_deinit(src);
+ }
+}
+
+static u8*
+fib_entry_src_interpose_format (fib_entry_src_t *src,
+ u8* s)
+{
+ s = format(s, " cover:%d interpose:\n%U%U",
+ src->u.interpose.fesi_cover,
+ format_white_space, 6,
+ format_dpo_id, &src->u.interpose.fesi_dpo, 8);
+
+ return (s);
+}
+
+const static fib_entry_src_vft_t interpose_src_vft = {
+ .fesv_init = fib_entry_src_interpose_init,
+ .fesv_deinit = fib_entry_src_interpose_deinit,
+ .fesv_activate = fib_entry_src_interpose_activate,
+ .fesv_reactivate = fib_entry_src_interpose_reactivate,
+ .fesv_deactivate = fib_entry_src_interpose_deactivate,
+ .fesv_cover_change = fib_entry_src_interpose_cover_change,
+ .fesv_cover_update = fib_entry_src_rr_cover_update,
+ .fesv_format = fib_entry_src_interpose_format,
+ .fesv_add = fib_entry_src_interpose_add,
+ .fesv_remove = fib_entry_src_interpose_remove,
+ .fesv_contribute_interpose = fib_entry_src_interpose_contribute,
+ .fesv_set_data = fib_entry_src_interpose_set_data,
+ .fesv_copy = fib_entry_src_interpose_copy,
+ .fesv_flags_change = fib_entry_src_interpose_flag_change,
+};
+
+void
+fib_entry_src_interpose_register (void)
+{
+ fib_entry_src_register(FIB_SOURCE_INTERPOSE, &interpose_src_vft);
+}
diff --git a/src/vnet/fib/fib_entry_src_lisp.c b/src/vnet/fib/fib_entry_src_lisp.c
index e72dce6333d..ec8c467d1cf 100644
--- a/src/vnet/fib/fib_entry_src_lisp.c
+++ b/src/vnet/fib/fib_entry_src_lisp.c
@@ -104,14 +104,14 @@ fib_entry_src_lisp_set_data (fib_entry_src_t *src,
const fib_entry_t *entry,
const void *data)
{
- src->lisp.fesl_fib_index = *(u32*)data;
+ src->u.lisp.fesl_fib_index = *(u32*)data;
}
static const void*
fib_entry_src_lisp_get_data (fib_entry_src_t *src,
const fib_entry_t *entry)
{
- return (&(src->lisp.fesl_fib_index));
+ return (&(src->u.lisp.fesl_fib_index));
}
const static fib_entry_src_vft_t api_src_vft = {
diff --git a/src/vnet/fib/fib_entry_src_mpls.c b/src/vnet/fib/fib_entry_src_mpls.c
index f80d42afbb0..32a620de713 100644
--- a/src/vnet/fib/fib_entry_src_mpls.c
+++ b/src/vnet/fib/fib_entry_src_mpls.c
@@ -22,7 +22,7 @@
#include <vnet/fib/mpls_fib.h>
/**
- * Source initialisation Function
+ * Source initialisation Function
*/
static void
fib_entry_src_mpls_init (fib_entry_src_t *src)
@@ -30,16 +30,16 @@ fib_entry_src_mpls_init (fib_entry_src_t *src)
mpls_eos_bit_t eos;
src->fes_flags = FIB_ENTRY_SRC_FLAG_NONE;
- src->mpls.fesm_label = MPLS_LABEL_INVALID;
+ src->u.mpls.fesm_label = MPLS_LABEL_INVALID;
FOR_EACH_MPLS_EOS_BIT(eos)
{
- src->mpls.fesm_lfes[eos] = FIB_NODE_INDEX_INVALID;
+ src->u.mpls.fesm_lfes[eos] = FIB_NODE_INDEX_INVALID;
}
}
/**
- * Source deinitialisation Function
+ * Source deinitialisation Function
*/
static void
fib_entry_src_mpls_deinit (fib_entry_src_t *src)
@@ -50,7 +50,7 @@ static void
fib_entry_src_mpls_remove (fib_entry_src_t *src)
{
src->fes_pl = FIB_NODE_INDEX_INVALID;
- src->mpls.fesm_label = MPLS_LABEL_INVALID;
+ src->u.mpls.fesm_label = MPLS_LABEL_INVALID;
}
static void
@@ -61,9 +61,9 @@ fib_entry_src_mpls_add (fib_entry_src_t *src,
const dpo_id_t *dpo)
{
src->fes_pl =
- fib_path_list_create_special(proto,
- FIB_PATH_LIST_FLAG_DROP,
- drop_dpo_get(proto));
+ fib_path_list_create_special(proto,
+ FIB_PATH_LIST_FLAG_DROP,
+ drop_dpo_get(proto));
}
static void
@@ -91,71 +91,71 @@ fib_entry_src_mpls_set_data (fib_entry_src_t *src,
*/
FOR_EACH_MPLS_EOS_BIT(eos)
{
- fib_table_entry_delete_index(src->mpls.fesm_lfes[eos],
- FIB_SOURCE_SPECIAL);
+ fib_table_entry_delete_index(src->u.mpls.fesm_lfes[eos],
+ FIB_SOURCE_SPECIAL);
}
fib_table_unlock(MPLS_FIB_DEFAULT_TABLE_ID,
FIB_PROTOCOL_MPLS,
FIB_SOURCE_MPLS);
- src->mpls.fesm_label = label;
+ src->u.mpls.fesm_label = label;
}
else
{
- fib_prefix_t prefix = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = label,
- };
- fib_node_index_t fib_index;
- dpo_id_t dpo = DPO_INVALID;
+ fib_prefix_t prefix = {
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = label,
+ };
+ fib_node_index_t fib_index;
+ dpo_id_t dpo = DPO_INVALID;
/*
* adding a new local label. make sure the MPLS fib exists.
*/
- if (MPLS_LABEL_INVALID == src->mpls.fesm_label)
+ if (MPLS_LABEL_INVALID == src->u.mpls.fesm_label)
{
fib_index =
- fib_table_find_or_create_and_lock(FIB_PROTOCOL_MPLS,
- MPLS_FIB_DEFAULT_TABLE_ID,
+ fib_table_find_or_create_and_lock(FIB_PROTOCOL_MPLS,
+ MPLS_FIB_DEFAULT_TABLE_ID,
FIB_SOURCE_MPLS);
}
- else
- {
- fib_index = mpls_fib_index_from_table_id(MPLS_FIB_DEFAULT_TABLE_ID);
-
- /*
- * if this is a change in label, reomve the old one first
- */
- if (src->mpls.fesm_label != label)
- {
- FOR_EACH_MPLS_EOS_BIT(eos)
- {
- ASSERT(FIB_NODE_INDEX_INVALID != src->mpls.fesm_lfes[eos]);
- fib_table_entry_delete_index(src->mpls.fesm_lfes[eos],
- FIB_SOURCE_SPECIAL);
- }
- }
- }
-
- src->mpls.fesm_label = label;
-
- FOR_EACH_MPLS_EOS_BIT(eos)
- {
- prefix.fp_eos = eos;
- prefix.fp_payload_proto = fib_proto_to_dpo(payload_proto);
-
- fib_entry_contribute_forwarding(fei,
- (eos ?
- FIB_FORW_CHAIN_TYPE_MPLS_EOS :
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS),
- &dpo);
- src->mpls.fesm_lfes[eos] =
- fib_table_entry_special_dpo_add(fib_index,
- &prefix,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_EXCLUSIVE,
- &dpo);
- dpo_reset(&dpo);
- }
+ else
+ {
+ fib_index = mpls_fib_index_from_table_id(MPLS_FIB_DEFAULT_TABLE_ID);
+
+ /*
+ * if this is a change in label, reomve the old one first
+ */
+ if (src->u.mpls.fesm_label != label)
+ {
+ FOR_EACH_MPLS_EOS_BIT(eos)
+ {
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.mpls.fesm_lfes[eos]);
+ fib_table_entry_delete_index(src->u.mpls.fesm_lfes[eos],
+ FIB_SOURCE_SPECIAL);
+ }
+ }
+ }
+
+ src->u.mpls.fesm_label = label;
+
+ FOR_EACH_MPLS_EOS_BIT(eos)
+ {
+ prefix.fp_eos = eos;
+ prefix.fp_payload_proto = fib_proto_to_dpo(payload_proto);
+
+ fib_entry_contribute_forwarding(fei,
+ (eos ?
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS :
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS),
+ &dpo);
+ src->u.mpls.fesm_lfes[eos] =
+ fib_table_entry_special_dpo_add(fib_index,
+ &prefix,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_EXCLUSIVE,
+ &dpo);
+ dpo_reset(&dpo);
+ }
}
}
@@ -163,14 +163,14 @@ static const void *
fib_entry_src_mpls_get_data (fib_entry_src_t *src,
const fib_entry_t *entry)
{
- return (&(src->mpls.fesm_label));
+ return (&(src->u.mpls.fesm_label));
}
static u8*
fib_entry_src_mpls_format (fib_entry_src_t *src,
- u8* s)
+ u8* s)
{
- return (format(s, " local-label:%d", src->mpls.fesm_label));
+ return (format(s, " local-label:%d", src->u.mpls.fesm_label));
}
const static fib_entry_src_vft_t mpls_src_vft = {
@@ -193,7 +193,5 @@ const static fib_entry_src_vft_t mpls_src_vft = {
void
fib_entry_src_mpls_register (void)
{
- fib_entry_src_register(FIB_SOURCE_MPLS, &mpls_src_vft);
+ fib_entry_src_register(FIB_SOURCE_MPLS, &mpls_src_vft);
}
-
-
diff --git a/src/vnet/fib/fib_entry_src_rr.c b/src/vnet/fib/fib_entry_src_rr.c
index b6f4bc3ba45..8e477362374 100644
--- a/src/vnet/fib/fib_entry_src_rr.c
+++ b/src/vnet/fib/fib_entry_src_rr.c
@@ -20,6 +20,7 @@
#include <vnet/dpo/drop_dpo.h>
#include "fib_entry_src.h"
+#include "fib_entry_src_rr.h"
#include "fib_entry_cover.h"
#include "fib_entry.h"
#include "fib_table.h"
@@ -29,7 +30,7 @@
*
* Resolve via a connected cover.
*/
-static void
+void
fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
const fib_entry_t *fib_entry,
const fib_entry_t *cover)
@@ -53,7 +54,8 @@ fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
* shortly to over-rule this RR source.
*/
src->fes_pl = fib_path_list_create(FIB_PATH_LIST_FLAG_NONE, paths);
- src->fes_entry_flags = fib_entry_get_flags(fib_entry_get_index(cover));
+ src->fes_entry_flags |= (fib_entry_get_flags(fib_entry_get_index(cover)) &
+ FIB_ENTRY_FLAGS_RR_INHERITED);
vec_free(paths);
}
@@ -65,8 +67,8 @@ fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
static void
fib_entry_src_rr_init (fib_entry_src_t *src)
{
- src->rr.fesr_cover = FIB_NODE_INDEX_INVALID;
- src->rr.fesr_sibling = FIB_NODE_INDEX_INVALID;
+ src->u.rr.fesr_cover = FIB_NODE_INDEX_INVALID;
+ src->u.rr.fesr_sibling = FIB_NODE_INDEX_INVALID;
}
@@ -84,7 +86,7 @@ fib_entry_src_rr_init (fib_entry_src_t *src)
* the loop will break when the cover changes, and this function
* will be called again when that happens.
*/
-static void
+void
fib_entry_src_rr_use_covers_pl (fib_entry_src_t *src,
const fib_entry_t *fib_entry,
const fib_entry_t *cover)
@@ -132,14 +134,14 @@ fib_entry_src_rr_activate (fib_entry_src_t *src,
return (!0);
}
- src->rr.fesr_cover = fib_table_get_less_specific(fib_entry->fe_fib_index,
+ src->u.rr.fesr_cover = fib_table_get_less_specific(fib_entry->fe_fib_index,
&fib_entry->fe_prefix);
- ASSERT(FIB_NODE_INDEX_INVALID != src->rr.fesr_cover);
+ ASSERT(FIB_NODE_INDEX_INVALID != src->u.rr.fesr_cover);
- cover = fib_entry_get(src->rr.fesr_cover);
+ cover = fib_entry_get(src->u.rr.fesr_cover);
- src->rr.fesr_sibling =
+ src->u.rr.fesr_sibling =
fib_entry_cover_track(cover, fib_entry_get_index(fib_entry));
/*
@@ -175,11 +177,11 @@ fib_entry_src_rr_deactivate (fib_entry_src_t *src,
/*
* remove the depednecy on the covering entry
*/
- if (FIB_NODE_INDEX_INVALID != src->rr.fesr_cover)
+ if (FIB_NODE_INDEX_INVALID != src->u.rr.fesr_cover)
{
- cover = fib_entry_get(src->rr.fesr_cover);
- fib_entry_cover_untrack(cover, src->rr.fesr_sibling);
- src->rr.fesr_cover = FIB_NODE_INDEX_INVALID;
+ cover = fib_entry_get(src->u.rr.fesr_cover);
+ fib_entry_cover_untrack(cover, src->u.rr.fesr_sibling);
+ src->u.rr.fesr_cover = FIB_NODE_INDEX_INVALID;
}
fib_path_list_unlock(src->fes_pl);
@@ -187,7 +189,7 @@ fib_entry_src_rr_deactivate (fib_entry_src_t *src,
src->fes_entry_flags = FIB_ENTRY_FLAG_NONE;
}
-static fib_entry_src_cover_res_t
+fib_entry_src_cover_res_t
fib_entry_src_rr_cover_change (fib_entry_src_t *src,
const fib_entry_t *fib_entry)
{
@@ -196,7 +198,7 @@ fib_entry_src_rr_cover_change (fib_entry_src_t *src,
.bw_reason = FIB_NODE_BW_REASON_FLAG_NONE,
};
- if (FIB_NODE_INDEX_INVALID == src->rr.fesr_cover)
+ if (FIB_NODE_INDEX_INVALID == src->u.rr.fesr_cover)
{
/*
* the source may be added, but it is not active
@@ -210,7 +212,7 @@ fib_entry_src_rr_cover_change (fib_entry_src_t *src,
* entry inserted benaeth it. That does not necessarily mean that this
* entry is covered by the new prefix. check that
*/
- if (src->rr.fesr_cover != fib_table_get_less_specific(fib_entry->fe_fib_index,
+ if (src->u.rr.fesr_cover != fib_table_get_less_specific(fib_entry->fe_fib_index,
&fib_entry->fe_prefix))
{
fib_entry_src_rr_deactivate(src, fib_entry);
@@ -230,7 +232,7 @@ fib_entry_src_rr_cover_change (fib_entry_src_t *src,
* This entry's cover has updated its forwarding info. This entry
* will need to re-inheret.
*/
-static fib_entry_src_cover_res_t
+fib_entry_src_cover_res_t
fib_entry_src_rr_cover_update (fib_entry_src_t *src,
const fib_entry_t *fib_entry)
{
@@ -241,7 +243,7 @@ fib_entry_src_rr_cover_update (fib_entry_src_t *src,
fib_node_index_t old_path_list;
fib_entry_t *cover;
- if (FIB_NODE_INDEX_INVALID == src->rr.fesr_cover)
+ if (FIB_NODE_INDEX_INVALID == src->u.rr.fesr_cover)
{
/*
* the source may be added, but it is not active
@@ -250,7 +252,7 @@ fib_entry_src_rr_cover_update (fib_entry_src_t *src,
return (res);
}
- cover = fib_entry_get(src->rr.fesr_cover);
+ cover = fib_entry_get(src->u.rr.fesr_cover);
old_path_list = src->fes_pl;
/*
@@ -280,7 +282,7 @@ static u8*
fib_entry_src_rr_format (fib_entry_src_t *src,
u8* s)
{
- return (format(s, " cover:%d", src->rr.fesr_cover));
+ return (format(s, " cover:%d", src->u.rr.fesr_cover));
}
const static fib_entry_src_vft_t rr_src_vft = {
diff --git a/src/vnet/fib/fib_entry_src_rr.h b/src/vnet/fib/fib_entry_src_rr.h
new file mode 100644
index 00000000000..e8592d9e53b
--- /dev/null
+++ b/src/vnet/fib/fib_entry_src_rr.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FIB_ENTRY_SRC_RR_H__
+#define __FIB_ENTRY_SRC_RR_H__
+
+#include "fib_entry_src.h"
+
+/*
+ * the flags that an RR sourced entry can inherit from its cover
+ */
+#define FIB_ENTRY_FLAGS_RR_INHERITED (FIB_ENTRY_FLAG_CONNECTED | \
+ FIB_ENTRY_FLAG_ATTACHED)
+
+/*
+ * fib_entry_src_rr_resolve_via_connected
+ *
+ * Resolve via a connected cover.
+ */
+void
+fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry,
+ const fib_entry_t *cover);
+
+/*
+ * use the path-list of the cover, unless it would form a loop.
+ * that is unless the cover is via this entry.
+ * If a loop were to form it would be a 1 level loop (i.e. X via X),
+ * and there would be 2 locks on the path-list; one since its used
+ * by the cover, and 1 from here. The first lock will go when the
+ * cover is removed, the second, and last, when the covered walk
+ * occurs during the cover's removel - this is not a place where
+ * we can handle last lock gone.
+ * In short, don't let the loop form. The usual rules of 'we must
+ * let it form so we know when it breaks' don't apply here, since
+ * the loop will break when the cover changes, and this function
+ * will be called again when that happens.
+ */
+void
+fib_entry_src_rr_use_covers_pl (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry,
+ const fib_entry_t *cover);
+
+
+/*
+ * fib_entry_src_rr_cover_update
+ *
+ * This entry's cover has changed. This entry
+ * will need to re-inheret.
+ */
+fib_entry_src_cover_res_t
+fib_entry_src_rr_cover_change (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry);
+
+/*
+ * fib_entry_src_rr_cover_update
+ *
+ * This entry's cover has updated its forwarding info. This entry
+ * will need to re-inheret.
+ */
+fib_entry_src_cover_res_t
+fib_entry_src_rr_cover_update (fib_entry_src_t *src,
+ const fib_entry_t *fib_entry);
+
+#endif
diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c
index e9eaa75a08e..8aee5aaa18a 100644
--- a/src/vnet/fib/fib_path_list.c
+++ b/src/vnet/fib/fib_path_list.c
@@ -1011,14 +1011,12 @@ fib_path_list_path_remove (fib_node_index_t path_list_index,
fib_node_index_t
fib_path_list_copy_and_path_remove (fib_node_index_t orig_path_list_index,
fib_path_list_flags_t flags,
- const fib_route_path_t *rpaths)
+ const fib_route_path_t *rpath)
{
fib_node_index_t path_index, *orig_path_index, path_list_index, tmp_path_index;
fib_path_list_t *path_list, *orig_path_list;
fib_node_index_t pi;
- ASSERT(1 == vec_len(rpaths));
-
path_list = fib_path_list_alloc(&path_list_index);
flags = fib_path_list_flags_fixup(flags);
@@ -1041,8 +1039,7 @@ fib_path_list_copy_and_path_remove (fib_node_index_t orig_path_list_index,
* create a representation of the path to be removed, so it
* can be used as a comparison object during the copy.
*/
- tmp_path_index = fib_path_create(path_list_index,
- rpaths);
+ tmp_path_index = fib_path_create(path_list_index, rpath);
vec_foreach (orig_path_index, orig_path_list->fpl_paths)
{
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index 61ba9348fd8..56e885ccdaf 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -30,6 +30,7 @@
#include <vnet/dpo/replicate_dpo.h>
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/dpo/mpls_disposition.h>
+#include <vnet/dpo/punt_dpo.h>
#include <vnet/mpls/mpls.h>
@@ -51,20 +52,21 @@ static int fib_test_do_debug;
({ \
int _evald = (_cond); \
if (!(_evald)) { \
- fformat(stderr, "FAIL:%d: " _comment "\n", \
- __LINE__, ##_args); \
+ fformat(stderr, "FAIL:%d: " _comment "\n", \
+ __LINE__, ##_args); \
+ res = 1; \
} else { \
- if (fib_test_do_debug) \
+ if (fib_test_do_debug) \
fformat(stderr, "PASS:%d: " _comment "\n", \
__LINE__, ##_args); \
} \
- _evald; \
+ res; \
})
#define FIB_TEST(_cond, _comment, _args...) \
{ \
- if (!FIB_TEST_I(_cond, _comment, ##_args)) { \
- return 1; \
- ASSERT(!("FAIL: " _comment)); \
+ if (FIB_TEST_I(_cond, _comment, ##_args)) { \
+ return 1; \
+ ASSERT(!("FAIL: " _comment)); \
} \
}
@@ -92,11 +94,11 @@ static u8 * format_test_interface_name (u8 * s, va_list * args)
}
static uword dummy_interface_tx (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
- clib_warning ("you shouldn't be here, leaking buffers...");
- return frame->n_vectors;
+ clib_warning ("you shouldn't be here, leaking buffers...");
+ return frame->n_vectors;
}
static clib_error_t *
@@ -104,17 +106,17 @@ test_interface_admin_up_down (vnet_main_t * vnm,
u32 hw_if_index,
u32 flags)
{
- u32 hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
- VNET_HW_INTERFACE_FLAG_LINK_UP : 0;
- vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
- return 0;
+ u32 hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
+ VNET_HW_INTERFACE_FLAG_LINK_UP : 0;
+ vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
+ return 0;
}
VNET_DEVICE_CLASS (test_interface_device_class,static) = {
- .name = "Test interface",
- .format_device_name = format_test_interface_name,
- .tx_function = dummy_interface_tx,
- .admin_up_down_function = test_interface_admin_up_down,
+ .name = "Test interface",
+ .format_device_name = format_test_interface_name,
+ .tx_function = dummy_interface_tx,
+ .admin_up_down_function = test_interface_admin_up_down,
};
static u8 *hw_address;
@@ -124,139 +126,141 @@ fib_test_mk_intf (u32 ninterfaces)
{
clib_error_t * error = NULL;
test_main_t *tm = &test_main;
+ u32 i, res;
u8 byte;
- u32 i;
+ res = 0;
ASSERT(ninterfaces <= ARRAY_LEN(tm->hw_if_indicies));
for (i=0; i<6; i++)
{
- byte = 0xd0+i;
- vec_add1(hw_address, byte);
+ byte = 0xd0+i;
+ vec_add1(hw_address, byte);
}
for (i = 0; i < ninterfaces; i++)
{
- hw_address[5] = i;
+ hw_address[5] = i;
- error = ethernet_register_interface(vnet_get_main(),
+ error = ethernet_register_interface(vnet_get_main(),
test_interface_device_class.index,
- i /* instance */,
- hw_address,
- &tm->hw_if_indicies[i],
- /* flag change */ 0);
+ i /* instance */,
+ hw_address,
+ &tm->hw_if_indicies[i],
+ /* flag change */ 0);
+
+ FIB_TEST((NULL == error), "ADD interface %d", i);
- FIB_TEST((NULL == error), "ADD interface %d", i);
-
error = vnet_hw_interface_set_flags(vnet_get_main(),
tm->hw_if_indicies[i],
VNET_HW_INTERFACE_FLAG_LINK_UP);
tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
- tm->hw_if_indicies[i]);
- vec_validate (ip4_main.fib_index_by_sw_if_index,
+ tm->hw_if_indicies[i]);
+ vec_validate (ip4_main.fib_index_by_sw_if_index,
tm->hw[i]->sw_if_index);
- vec_validate (ip6_main.fib_index_by_sw_if_index,
+ vec_validate (ip6_main.fib_index_by_sw_if_index,
tm->hw[i]->sw_if_index);
- ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
- ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
+ ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
+ ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
- error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[i]->sw_if_index,
- VNET_SW_INTERFACE_FLAG_ADMIN_UP);
- FIB_TEST((NULL == error), "UP interface %d", i);
+ error = vnet_sw_interface_set_flags(vnet_get_main(),
+ tm->hw[i]->sw_if_index,
+ VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ FIB_TEST((NULL == error), "UP interface %d", i);
}
/*
* re-eval after the inevitable realloc
*/
for (i = 0; i < ninterfaces; i++)
{
- tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
- tm->hw_if_indicies[i]);
+ tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
+ tm->hw_if_indicies[i]);
}
- return (0);
+ return (res);
}
#define FIB_TEST_REC_FORW(_rec_prefix, _via_prefix, _bucket) \
-{ \
- const dpo_id_t *_rec_dpo = fib_entry_contribute_ip_forwarding( \
- fib_table_lookup_exact_match(fib_index, (_rec_prefix))); \
- const dpo_id_t *_via_dpo = fib_entry_contribute_ip_forwarding( \
- fib_table_lookup(fib_index, (_via_prefix))); \
- FIB_TEST(!dpo_cmp(_via_dpo, \
- load_balance_get_bucket(_rec_dpo->dpoi_index, \
- _bucket)), \
- "%U is recursive via %U", \
- format_fib_prefix, (_rec_prefix), \
- format_fib_prefix, _via_prefix); \
-}
+ { \
+ const dpo_id_t *_rec_dpo = fib_entry_contribute_ip_forwarding( \
+ fib_table_lookup_exact_match(fib_index, (_rec_prefix))); \
+ const dpo_id_t *_via_dpo = fib_entry_contribute_ip_forwarding( \
+ fib_table_lookup(fib_index, (_via_prefix))); \
+ FIB_TEST(!dpo_cmp(_via_dpo, \
+ load_balance_get_bucket(_rec_dpo->dpoi_index, \
+ _bucket)), \
+ "%U is recursive via %U", \
+ format_fib_prefix, (_rec_prefix), \
+ format_fib_prefix, _via_prefix); \
+ }
#define FIB_TEST_LB_BUCKET_VIA_ADJ(_prefix, _bucket, _ai) \
-{ \
- const dpo_id_t *_dpo = fib_entry_contribute_ip_forwarding( \
- fib_table_lookup_exact_match(fib_index, (_prefix))); \
- const dpo_id_t *_dpo1 = \
- load_balance_get_bucket(_dpo->dpoi_index, _bucket); \
- FIB_TEST(DPO_ADJACENCY == _dpo1->dpoi_type, "type is %U", \
- format_dpo_type, _dpo1->dpoi_type); \
- FIB_TEST((_ai == _dpo1->dpoi_index), \
- "%U bucket %d resolves via %U", \
- format_fib_prefix, (_prefix), \
- _bucket, \
- format_dpo_id, _dpo1, 0); \
-}
-
-#define FIB_TEST_RPF(_cond, _comment, _args...) \
-{ \
- if (!FIB_TEST_I(_cond, _comment, ##_args)) { \
- return (0); \
- } \
-}
+ { \
+ const dpo_id_t *_dpo = fib_entry_contribute_ip_forwarding( \
+ fib_table_lookup_exact_match(fib_index, (_prefix))); \
+ const dpo_id_t *_dpo1 = \
+ load_balance_get_bucket(_dpo->dpoi_index, _bucket); \
+ FIB_TEST(DPO_ADJACENCY == _dpo1->dpoi_type, "type is %U", \
+ format_dpo_type, _dpo1->dpoi_type); \
+ FIB_TEST((_ai == _dpo1->dpoi_index), \
+ "%U bucket %d resolves via %U", \
+ format_fib_prefix, (_prefix), \
+ _bucket, \
+ format_dpo_id, _dpo1, 0); \
+ }
+
+#define FIB_TEST_RPF(_cond, _comment, _args...) \
+ { \
+ if (FIB_TEST_I(_cond, _comment, ##_args)) { \
+ return (1); \
+ } \
+ }
static int
fib_test_urpf_is_equal (fib_node_index_t fei,
- fib_forward_chain_type_t fct,
- u32 num, ...)
+ fib_forward_chain_type_t fct,
+ u32 num, ...)
{
dpo_id_t dpo = DPO_INVALID;
fib_urpf_list_t *urpf;
+ int ii, res;
index_t ui;
va_list ap;
- int ii;
va_start(ap, num);
+ res = 0;
fib_entry_contribute_forwarding(fei, fct, &dpo);
ui = load_balance_get_urpf(dpo.dpoi_index);
urpf = fib_urpf_list_get(ui);
FIB_TEST_RPF(num == vec_len(urpf->furpf_itfs),
- "RPF:%U len %d == %d",
- format_fib_urpf_list, ui,
- num, vec_len(urpf->furpf_itfs));
+ "RPF:%U len %d == %d",
+ format_fib_urpf_list, ui,
+ num, vec_len(urpf->furpf_itfs));
FIB_TEST_RPF(num == fib_urpf_check_size(ui),
- "RPF:%U check-size %d == %d",
- format_fib_urpf_list, ui,
- num, vec_len(urpf->furpf_itfs));
+ "RPF:%U check-size %d == %d",
+ format_fib_urpf_list, ui,
+ num, vec_len(urpf->furpf_itfs));
for (ii = 0; ii < num; ii++)
{
- adj_index_t ai = va_arg(ap, adj_index_t);
-
- FIB_TEST_RPF(ai == urpf->furpf_itfs[ii],
- "RPF:%d item:%d - %d == %d",
- ui, ii, ai, urpf->furpf_itfs[ii]);
- FIB_TEST_RPF(fib_urpf_check(ui, ai),
- "RPF:%d %d found",
- ui, ai);
+ adj_index_t ai = va_arg(ap, adj_index_t);
+
+ FIB_TEST_RPF(ai == urpf->furpf_itfs[ii],
+ "RPF:%d item:%d - %d == %d",
+ ui, ii, ai, urpf->furpf_itfs[ii]);
+ FIB_TEST_RPF(fib_urpf_check(ui, ai),
+ "RPF:%d %d found",
+ ui, ai);
}
dpo_reset(&dpo);
va_end(ap);
- return (1);
+ return (res);
}
static u8*
@@ -272,12 +276,12 @@ fib_test_build_rewrite (u8 *eth_addr)
return (rewrite);
}
-#define FIB_TEST_LB(_cond, _comment, _args...) \
-{ \
- if (!FIB_TEST_I(_cond, _comment, ##_args)) { \
- return (0); \
- } \
-}
+#define FIB_TEST_LB(_cond, _comment, _args...) \
+ { \
+ if (FIB_TEST_I(_cond, _comment, ##_args)) { \
+ return (1); \
+ } \
+ }
int
fib_test_validate_rep_v (const replicate_t *rep,
@@ -286,57 +290,59 @@ fib_test_validate_rep_v (const replicate_t *rep,
{
const fib_test_rep_bucket_t *exp;
const dpo_id_t *dpo;
- int bucket;
+ int bucket, res;
+ res = 0;
FIB_TEST_LB((n_buckets == rep->rep_n_buckets),
"n_buckets = %d", rep->rep_n_buckets);
for (bucket = 0; bucket < n_buckets; bucket++)
{
- exp = va_arg(*ap, fib_test_rep_bucket_t*);
+ exp = va_arg(*ap, fib_test_rep_bucket_t*);
dpo = replicate_get_bucket_i(rep, bucket);
- switch (exp->type)
- {
- case FT_REP_LABEL_O_ADJ:
- {
- const mpls_label_dpo_t *mld;
+ switch (exp->type)
+ {
+ case FT_REP_LABEL_O_ADJ:
+ {
+ const mpls_label_dpo_t *mld;
mpls_label_t hdr;
+
FIB_TEST_LB((mpls_label_dpo_get_type(MPLS_LABEL_DPO_FLAG_NONE)
== dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
-
- mld = mpls_label_dpo_get(dpo->dpoi_index);
+
+ mld = mpls_label_dpo_get(dpo->dpoi_index);
hdr = clib_net_to_host_u32(mld->mld_hdr[0].label_exp_s_ttl);
- FIB_TEST_LB((vnet_mpls_uc_get_label(hdr) ==
- exp->label_o_adj.label),
- "bucket %d stacks on label %d",
- bucket,
- exp->label_o_adj.label);
+ FIB_TEST_LB((vnet_mpls_uc_get_label(hdr) ==
+ exp->label_o_adj.label),
+ "bucket %d stacks on label %d",
+ bucket,
+ exp->label_o_adj.label);
- FIB_TEST_LB((vnet_mpls_uc_get_s(hdr) ==
- exp->label_o_adj.eos),
- "bucket %d stacks on label %d %U",
- bucket,
- exp->label_o_adj.label,
- format_mpls_eos_bit, exp->label_o_adj.eos);
+ FIB_TEST_LB((vnet_mpls_uc_get_s(hdr) ==
+ exp->label_o_adj.eos),
+ "bucket %d stacks on label %d %U",
+ bucket,
+ exp->label_o_adj.label,
+ format_mpls_eos_bit, exp->label_o_adj.eos);
- FIB_TEST_LB((DPO_ADJACENCY_INCOMPLETE == mld->mld_dpo.dpoi_type),
- "bucket %d label stacks on %U",
- bucket,
- format_dpo_type, mld->mld_dpo.dpoi_type);
+ FIB_TEST_LB((DPO_ADJACENCY_INCOMPLETE == mld->mld_dpo.dpoi_type),
+ "bucket %d label stacks on %U",
+ bucket,
+ format_dpo_type, mld->mld_dpo.dpoi_type);
- FIB_TEST_LB((exp->label_o_adj.adj == mld->mld_dpo.dpoi_index),
- "bucket %d label stacks on adj %d",
- bucket,
- exp->label_o_adj.adj);
- }
- break;
- case FT_REP_INTF:
+ FIB_TEST_LB((exp->label_o_adj.adj == mld->mld_dpo.dpoi_index),
+ "bucket %d label stacks on adj %d",
+ bucket,
+ exp->label_o_adj.adj);
+ }
+ break;
+ case FT_REP_INTF:
FIB_TEST_LB((DPO_INTERFACE_RX == dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
@@ -346,32 +352,33 @@ fib_test_validate_rep_v (const replicate_t *rep,
"bucket %d stacks on adj %d",
bucket,
exp->adj.adj);
- break;
+ break;
case FT_REP_DISP_MFIB_LOOKUP:
// ASSERT(0);
break;
}
}
- return (!0);
+ return (res);
}
int
fib_test_validate_lb_v (const load_balance_t *lb,
- int n_buckets,
- va_list *ap)
+ int n_buckets,
+ va_list *ap)
{
const dpo_id_t *dpo;
- int bucket;
+ int bucket, res;
+ res = 0;
FIB_TEST_LB((n_buckets == lb->lb_n_buckets), "n_buckets = %d", lb->lb_n_buckets);
for (bucket = 0; bucket < n_buckets; bucket++)
{
- const fib_test_lb_bucket_t *exp;
+ const fib_test_lb_bucket_t *exp;
- exp = va_arg(*ap, fib_test_lb_bucket_t*);
- dpo = load_balance_get_bucket_i(lb, bucket);
+ exp = va_arg(*ap, fib_test_lb_bucket_t*);
+ dpo = load_balance_get_bucket_i(lb, bucket);
switch (exp->type)
{
@@ -578,52 +585,59 @@ fib_test_validate_lb_v (const load_balance_t *lb,
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
- FIB_TEST_LB((exp->lb.lb == dpo->dpoi_index),
- "bucket %d stacks on lb %d not %d",
- bucket,
- dpo->dpoi_index,
+ FIB_TEST_LB((exp->lb.lb == dpo->dpoi_index),
+ "bucket %d stacks on lb %d not %d",
+ bucket,
+ dpo->dpoi_index,
exp->lb.lb);
- break;
- case FT_LB_BIER_TABLE:
- FIB_TEST_LB((DPO_BIER_TABLE == dpo->dpoi_type),
+ break;
+ case FT_LB_BIER_TABLE:
+ FIB_TEST_LB((DPO_BIER_TABLE == dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
- FIB_TEST_LB((exp->bier.table == dpo->dpoi_index),
- "bucket %d stacks on lb %d",
- bucket,
- exp->bier.table);
+ FIB_TEST_LB((exp->bier.table == dpo->dpoi_index),
+ "bucket %d stacks on lb %d",
+ bucket,
+ exp->bier.table);
break;
- case FT_LB_BIER_FMASK:
- FIB_TEST_LB((DPO_BIER_FMASK == dpo->dpoi_type),
+ case FT_LB_BIER_FMASK:
+ FIB_TEST_LB((DPO_BIER_FMASK == dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
- FIB_TEST_LB((exp->bier.fmask == dpo->dpoi_index),
- "bucket %d stacks on lb %d",
- bucket,
- exp->bier.fmask);
+ FIB_TEST_LB((exp->bier.fmask == dpo->dpoi_index),
+ "bucket %d stacks on lb %d",
+ bucket,
+ exp->bier.fmask);
break;
- case FT_LB_DROP:
- FIB_TEST_LB((DPO_DROP == dpo->dpoi_type),
+ case FT_LB_DROP:
+ FIB_TEST_LB((DPO_DROP == dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
- break;
- }
+ break;
+ case FT_LB_PUNT:
+ FIB_TEST_LB((DPO_PUNT == dpo->dpoi_type),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
+ break;
+ }
}
- return (!0);
+ return (res);
}
int
fib_test_validate_lb (const dpo_id_t *dpo,
- int n_buckets,
- ...)
+ int n_buckets,
+ ...)
{
const load_balance_t *lb;
va_list ap;
int res;
+ res = 0;
va_start(ap, n_buckets);
if (FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type),
@@ -636,7 +650,7 @@ fib_test_validate_lb (const dpo_id_t *dpo,
}
else
{
- res = !0;
+ res = 0;
}
va_end(ap);
@@ -646,9 +660,9 @@ fib_test_validate_lb (const dpo_id_t *dpo,
int
fib_test_validate_entry (fib_node_index_t fei,
- fib_forward_chain_type_t fct,
- int n_buckets,
- ...)
+ fib_forward_chain_type_t fct,
+ int n_buckets,
+ ...)
{
dpo_id_t dpo = DPO_INVALID;
fib_prefix_t pfx;
@@ -659,6 +673,7 @@ fib_test_validate_entry (fib_node_index_t fei,
va_start(ap, n_buckets);
+ res = 0;
fib_entry_get_prefix(fei, &pfx);
fib_index = fib_entry_get_fib_index(fei);
fib_entry_contribute_forwarding(fei, fct, &dpo);
@@ -740,19 +755,20 @@ fib_test_v4 (void)
test_main_t *tm;
u32 fib_index;
int lb_count;
- int ii;
+ int ii, res;
+ res = 0;
/* via 10.10.10.1 */
ip46_address_t nh_10_10_10_1 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
};
/* via 10.10.10.2 */
ip46_address_t nh_10_10_10_2 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
};
FIB_TEST((0 == pool_elts(load_balance_map_pool)), "LB-map pool size is %d",
- pool_elts(load_balance_map_pool));
+ pool_elts(load_balance_map_pool));
tm = &test_main;
@@ -765,27 +781,27 @@ fib_test_v4 (void)
for (ii = 0; ii < 4; ii++)
{
- ip4_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
+ ip4_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
}
fib_prefix_t pfx_0_0_0_0_s_0 = {
- .fp_len = 0,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- {0}
- },
- },
+ .fp_len = 0,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ {0}
+ },
+ },
};
fib_prefix_t pfx = {
- .fp_len = 0,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- {0}
- },
- },
+ .fp_len = 0,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ {0}
+ },
+ },
};
dpo_drop = drop_dpo_get(DPO_PROTO_IP4);
@@ -793,34 +809,34 @@ fib_test_v4 (void)
dfrt = fib_table_lookup(fib_index, &pfx_0_0_0_0_s_0);
FIB_TEST((FIB_NODE_INDEX_INVALID != dfrt), "default route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(dfrt)),
- "Default route is DROP");
+ "Default route is DROP");
pfx.fp_len = 32;
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "all zeros route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "all 0s route is DROP");
+ "all 0s route is DROP");
pfx.fp_addr.ip4.as_u32 = clib_host_to_net_u32(0xffffffff);
pfx.fp_len = 32;
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "all ones route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "all 1s route is DROP");
+ "all 1s route is DROP");
pfx.fp_addr.ip4.as_u32 = clib_host_to_net_u32(0xe0000000);
pfx.fp_len = 8;
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "all-mcast route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "all-mcast route is DROP");
+ "all-mcast route is DROP");
pfx.fp_addr.ip4.as_u32 = clib_host_to_net_u32(0xf0000000);
pfx.fp_len = 8;
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "class-e route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "class-e route is DROP");
+ "class-e route is DROP");
/*
* at this stage there are 5 entries in the test FIB (plus 5 in the default),
@@ -840,9 +856,9 @@ fib_test_v4 (void)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* add interface routes.
@@ -850,72 +866,72 @@ fib_test_v4 (void)
* test for the presence of the receive address in the glean and local adj
*/
fib_prefix_t local_pfx = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
- },
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
+ },
+ },
};
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1, // weight
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1, // weight
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached interface route present");
FIB_TEST(((FIB_ENTRY_FLAG_ATTACHED | FIB_ENTRY_FLAG_CONNECTED) ==
- fib_entry_get_flags(fei)),
- "Flags set on attached interface");
+ fib_entry_get_flags(fei)),
+ "Flags set on attached interface");
ai = fib_entry_get_adj(fei);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai),
"attached interface route adj present %d", ai);
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index),
- "attached interface adj is glean");
+ "attached interface adj is glean");
FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr,
- &adj->sub_type.glean.receive_addr)),
- "attached interface adj is receive ok");
+ &adj->sub_type.glean.receive_addr)),
+ "attached interface adj is receive ok");
local_pfx.fp_len = 32;
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1, // weight
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1, // weight
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &local_pfx);
FIB_TEST(((FIB_ENTRY_FLAG_LOCAL | FIB_ENTRY_FLAG_CONNECTED) ==
- fib_entry_get_flags(fei)),
- "Flags set on local interface");
+ fib_entry_get_flags(fei)),
+ "Flags set on local interface");
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "local interface route present");
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
- "RPF list for local length 0");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
+ "RPF list for local length 0");
dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST((DPO_RECEIVE == dpo->dpoi_type),
- "local interface adj is local");
+ "local interface adj is local");
receive_dpo_t *rd = receive_dpo_get(dpo->dpoi_index);
FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr,
- &rd->rd_addr)),
- "local interface adj is receive ok");
+ &rd->rd_addr)),
+ "local interface adj is receive ok");
FIB_TEST((2 == fib_table_get_num_entries(fib_index,
FIB_PROTOCOL_IP4,
@@ -927,9 +943,9 @@ fib_test_v4 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Modify the default route to be via an adj not yet known.
@@ -939,27 +955,27 @@ fib_test_v4 (void)
pfx.fp_addr.ip4.as_u32 = 0;
pfx.fp_len = 0;
fib_table_entry_path_add(fib_index, &pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((FIB_ENTRY_FLAG_NONE == fib_entry_get_flags(fei)),
- "Flags set on API route");
+ "Flags set on API route");
FIB_TEST((fei == dfrt), "default route same index");
ai = fib_entry_get_adj(fei);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai), "default route adj present");
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&nh_10_10_10_1, &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ "adj nbr next-hop ok");
FIB_TEST((1 == fib_table_get_num_entries(fib_index,
FIB_PROTOCOL_IP4,
FIB_SOURCE_API)),
@@ -969,9 +985,9 @@ fib_test_v4 (void)
* find the adj in the shared db
*/
locked_ai = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index);
FIB_TEST((locked_ai == ai), "ADJ NBR DB find");
adj_unlock(locked_ai);
@@ -979,11 +995,11 @@ fib_test_v4 (void)
* +1 shared path-list
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+3 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* remove the API source from the default route. We expected
@@ -992,62 +1008,62 @@ fib_test_v4 (void)
pfx.fp_addr.ip4.as_u32 = 0;
pfx.fp_len = 0;
fib_table_entry_path_remove(fib_index, &pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // non-recursive path, so no FIB index
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // non-recursive path, so no FIB index
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx);
FIB_TEST((fei == dfrt), "default route same index");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "Default route is DROP");
+ "Default route is DROP");
/*
* -1 shared-path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add an 2 ARP entry => a complete ADJ plus adj-fib.
*/
fib_prefix_t pfx_10_10_10_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.1 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.1 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ },
};
fib_prefix_t pfx_10_10_10_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.2 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.2 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
+ },
};
fib_prefix_t pfx_11_11_11_11_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 11.11.11.11 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0b0b0b0b),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 11.11.11.11 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0b0b0b0b),
+ },
};
u8 eth_addr[] = {
- 0xde, 0xde, 0xde, 0xba, 0xba, 0xba,
+ 0xde, 0xde, 0xde, 0xba, 0xba, 0xba,
};
ip46_address_t nh_12_12_12_12 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0c0c0c0c),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0c0c0c0c),
};
adj_index_t ai_12_12_12_12;
@@ -1059,7 +1075,7 @@ fib_test_v4 (void)
&pfx_11_11_11_11_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_ATTACHED,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&pfx_10_10_10_1_s_32.fp_addr,
tm->hw[0]->sw_if_index,
~0, // invalid fib index
@@ -1073,24 +1089,24 @@ fib_test_v4 (void)
"11.11.11.11/32 via incomplete adj");
ai_01 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &pfx_10_10_10_1_s_32.fp_addr,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP4,
+ &pfx_10_10_10_1_s_32.fp_addr,
+ tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_01), "adj created");
adj = adj_get(ai_01);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_1_s_32.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
adj_nbr_update_rewrite(ai_01, ADJ_NBR_REWRITE_FLAG_COMPLETE,
- fib_test_build_rewrite(eth_addr));
+ fib_test_build_rewrite(eth_addr));
FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index),
- "adj is complete");
+ "adj is complete");
FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_1_s_32.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "ADJ-FIB resolves via adj");
@@ -1098,25 +1114,25 @@ fib_test_v4 (void)
dpo1 = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST(DPO_ADJACENCY == dpo1->dpoi_type,
"11.11.11.11/32 via complete adj");
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
- tm->hw[0]->sw_if_index),
- "RPF list for adj-fib contains adj");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
+ tm->hw[0]->sw_if_index),
+ "RPF list for adj-fib contains adj");
ai_12_12_12_12 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &nh_12_12_12_12,
- tm->hw[1]->sw_if_index);
+ VNET_LINK_IP4,
+ &nh_12_12_12_12,
+ tm->hw[1]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_12_12_12_12), "adj created");
adj = adj_get(ai_12_12_12_12);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&nh_12_12_12_12,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
adj_nbr_update_rewrite(ai_12_12_12_12, ADJ_NBR_REWRITE_FLAG_COMPLETE,
- fib_test_build_rewrite(eth_addr));
+ fib_test_build_rewrite(eth_addr));
FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index),
- "adj is complete");
+ "adj is complete");
/*
* add the adj fib
@@ -1133,14 +1149,14 @@ fib_test_v4 (void)
NULL,
FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST((FIB_ENTRY_FLAG_ATTACHED == fib_entry_get_flags(fei)),
- "Flags set on adj-fib");
+ "Flags set on adj-fib");
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "ADJ-FIB resolves via adj, %d", ai);
fib_table_entry_path_remove(fib_index,
&pfx_11_11_11_11_s_32,
FIB_SOURCE_API,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&pfx_10_10_10_1_s_32.fp_addr,
tm->hw[0]->sw_if_index,
~0, // invalid fib index
@@ -1150,24 +1166,24 @@ fib_test_v4 (void)
eth_addr[5] = 0xb2;
ai_02 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &pfx_10_10_10_2_s_32.fp_addr,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP4,
+ &pfx_10_10_10_2_s_32.fp_addr,
+ tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_02), "adj created");
adj = adj_get(ai_02);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_2_s_32.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
adj_nbr_update_rewrite(ai_02, ADJ_NBR_REWRITE_FLAG_COMPLETE,
- fib_test_build_rewrite(eth_addr));
+ fib_test_build_rewrite(eth_addr));
FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index),
- "adj is complete");
+ "adj is complete");
FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_2_s_32.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
FIB_TEST((ai_01 != ai_02), "ADJs are different");
fib_table_entry_path_add(fib_index,
@@ -1191,33 +1207,33 @@ fib_test_v4 (void)
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add 2 routes via the first ADJ. ensure path-list sharing
*/
fib_prefix_t pfx_1_1_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 1.1.1.1/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 1.1.1.1/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "1.1.1.1 resolves via 10.10.10.1");
@@ -1227,30 +1243,30 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+5 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/* 1.1.2.0/24 */
fib_prefix_t pfx_1_1_2_0_s_24 = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010200),
- }
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010200),
+ }
};
fib_table_entry_path_add(fib_index,
- &pfx_1_1_2_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_2_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_2_0_s_24);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "1.1.2.0/24 resolves via 10.10.10.1");
@@ -1260,67 +1276,67 @@ fib_test_v4 (void)
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* modify 1.1.2.0/24 to use multipath.
*/
fib_table_entry_path_add(fib_index,
- &pfx_1_1_2_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_2_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_2_0_s_24);
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1, tm->hw[0]->sw_if_index),
- "RPF list for 1.1.2.0/24 contains both adjs");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1, tm->hw[0]->sw_if_index),
+ "RPF list for 1.1.2.0/24 contains both adjs");
dpo1 = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST(DPO_ADJACENCY == dpo1->dpoi_type, "type is %d", dpo1->dpoi_type);
FIB_TEST((ai_01 == dpo1->dpoi_index),
- "1.1.2.0/24 bucket 0 resolves via 10.10.10.1 (%d=%d)",
+ "1.1.2.0/24 bucket 0 resolves via 10.10.10.1 (%d=%d)",
ai_01, dpo1->dpoi_index);
dpo1 = load_balance_get_bucket(dpo->dpoi_index, 1);
FIB_TEST(DPO_ADJACENCY == dpo1->dpoi_type, "type is %d", dpo1->dpoi_type);
FIB_TEST((ai_02 == dpo1->dpoi_index),
- "1.1.2.0/24 bucket 1 resolves via 10.10.10.2");
+ "1.1.2.0/24 bucket 1 resolves via 10.10.10.2");
/*
* +1 shared-pathlist
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* revert the modify
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_2_0_s_24,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_2_0_s_24,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_2_0_s_24);
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1, tm->hw[0]->sw_if_index),
- "RPF list for 1.1.2.0/24 contains one adj");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1, tm->hw[0]->sw_if_index),
+ "RPF list for 1.1.2.0/24 contains one adj");
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "1.1.2.0/24 resolves via 10.10.10.1");
@@ -1329,11 +1345,11 @@ fib_test_v4 (void)
* +1 shared-pathlist
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB is %d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+6 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add 2 recursive routes:
@@ -1341,110 +1357,110 @@ fib_test_v4 (void)
* 100.100.100.101/32 via 1.1.1.1/32 => the via entry is installed.
*/
fib_prefix_t bgp_100_pfx = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 100.100.100.100/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x64646464),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 100.100.100.100/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x64646464),
+ },
};
/* via 1.1.1.1 */
ip46_address_t nh_1_1_1_1 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
};
fei = fib_table_entry_path_add(fib_index,
- &bgp_100_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_1_1_1_1,
- ~0, // no index provided.
- fib_index, // nexthop in same fib as route
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_100_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_1_1_1_1,
+ ~0, // no index provided.
+ fib_index, // nexthop in same fib as route
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST_REC_FORW(&bgp_100_pfx, &pfx_1_1_1_1_s_32, 0);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
- tm->hw[0]->sw_if_index),
- "RPF list for adj-fib contains adj");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
+ tm->hw[0]->sw_if_index),
+ "RPF list for adj-fib contains adj");
/*
* +1 entry and +1 shared-path-list
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
fib_prefix_t bgp_101_pfx = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 100.100.100.101/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x64646465),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 100.100.100.101/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x64646465),
+ },
};
fib_table_entry_path_add(fib_index,
- &bgp_101_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_1_1_1_1,
- ~0, // no index provided.
- fib_index, // nexthop in same fib as route
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_101_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_1_1_1_1,
+ ~0, // no index provided.
+ fib_index, // nexthop in same fib as route
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST_REC_FORW(&bgp_101_pfx, &pfx_1_1_1_1_s_32, 0);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
- tm->hw[0]->sw_if_index),
- "RPF list for adj-fib contains adj");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
+ tm->hw[0]->sw_if_index),
+ "RPF list for adj-fib contains adj");
/*
* +1 entry, but the recursive path-list is shared.
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+8 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* An special route; one where the user (me) provides the
* adjacency through which the route will resovle by setting the flags
*/
fib_prefix_t ex_pfx = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 4.4.4.4/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x04040404),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 4.4.4.4/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x04040404),
+ },
};
fib_table_entry_special_add(fib_index,
- &ex_pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_LOCAL);
+ &ex_pfx,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_LOCAL);
fei = fib_table_lookup_exact_match(fib_index, &ex_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST((DPO_RECEIVE == dpo->dpoi_type),
- "local interface adj is local");
+ "local interface adj is local");
fib_table_entry_special_remove(fib_index,
- &ex_pfx,
- FIB_SOURCE_SPECIAL);
+ &ex_pfx,
+ FIB_SOURCE_SPECIAL);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &ex_pfx),
- "Exclusive reoute removed");
+ fib_table_lookup_exact_match(fib_index, &ex_pfx),
+ "Exclusive reoute removed");
/*
* An EXCLUSIVE route; one where the user (me) provides the exclusive
@@ -1467,29 +1483,29 @@ fib_test_v4 (void)
fei = fib_table_lookup_exact_match(fib_index, &ex_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(&ex_dpo, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "exclusive remote uses lookup DPO");
+ "exclusive remote uses lookup DPO");
/*
* update the exclusive to use a different DPO
*/
ip_null_dpo_add_and_lock(DPO_PROTO_IP4,
- IP_NULL_ACTION_SEND_ICMP_UNREACH,
- &ex_dpo);
+ IP_NULL_ACTION_SEND_ICMP_UNREACH,
+ &ex_dpo);
fib_table_entry_special_dpo_update(fib_index,
- &ex_pfx,
- FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_EXCLUSIVE,
- &ex_dpo);
+ &ex_pfx,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_EXCLUSIVE,
+ &ex_dpo);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(&ex_dpo, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "exclusive remote uses now uses NULL DPO");
+ "exclusive remote uses now uses NULL DPO");
fib_table_entry_special_remove(fib_index,
- &ex_pfx,
- FIB_SOURCE_SPECIAL);
+ &ex_pfx,
+ FIB_SOURCE_SPECIAL);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &ex_pfx),
- "Exclusive reoute removed");
+ fib_table_lookup_exact_match(fib_index, &ex_pfx),
+ "Exclusive reoute removed");
dpo_reset(&ex_dpo);
/*
@@ -1497,20 +1513,20 @@ fib_test_v4 (void)
* 200.200.200.200/32 via 1.1.1.2/32 => the via entry is NOT installed.
*/
fib_prefix_t bgp_200_pfx = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 200.200.200.200/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0xc8c8c8c8),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 200.200.200.200/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0xc8c8c8c8),
+ },
};
/* via 1.1.1.2 */
fib_prefix_t pfx_1_1_1_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010102),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010102),
+ },
};
fei = fib_table_entry_path_add(fib_index,
@@ -1530,23 +1546,23 @@ fib_test_v4 (void)
/*
* the adj should be recursive via drop, since the route resolves via
- * the default route, which is itself a DROP
+ * the default route, which is itself a DROP
*/
fei = fib_table_lookup(fib_index, &pfx_1_1_1_2_s_32);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(load_balance_is_drop(dpo1), "1.1.1.2/32 is drop");
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
- "RPF list for 1.1.1.2/32 contains 0 adjs");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
+ "RPF list for 1.1.1.2/32 contains 0 adjs");
/*
* +2 entry and +1 shared-path-list
*/
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Unequal Cost load-balance. 3:1 ratio. fits in a 4 bucket LB
@@ -1554,17 +1570,17 @@ fib_test_v4 (void)
* weight is first in the set. This ordering is to test the RPF sort|uniq logic
*/
fib_prefix_t pfx_1_2_3_4_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01020304),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01020304),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_2_3_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ &pfx_1_2_3_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
tm->hw[0]->sw_if_index,
~0,
@@ -1575,7 +1591,7 @@ fib_test_v4 (void)
&pfx_1_2_3_4_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&nh_12_12_12_12,
tm->hw[1]->sw_if_index,
~0,
@@ -1595,10 +1611,10 @@ fib_test_v4 (void)
FIB_TEST_LB_BUCKET_VIA_ADJ(&pfx_1_2_3_4_s_32, 2, ai_12_12_12_12);
FIB_TEST_LB_BUCKET_VIA_ADJ(&pfx_1_2_3_4_s_32, 3, ai_01);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
- tm->hw[0]->sw_if_index,
- tm->hw[1]->sw_if_index),
- "RPF list for 1.2.3.4/32 contains both adjs");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
+ tm->hw[0]->sw_if_index,
+ tm->hw[1]->sw_if_index),
+ "RPF list for 1.2.3.4/32 contains both adjs");
/*
@@ -1606,17 +1622,17 @@ fib_test_v4 (void)
* fits in a 16 bucket LB with ratio 13:3
*/
fib_prefix_t pfx_1_2_3_5_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01020305),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01020305),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_2_3_5_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ &pfx_1_2_3_5_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
&nh_12_12_12_12,
tm->hw[1]->sw_if_index,
~0,
@@ -1627,7 +1643,7 @@ fib_test_v4 (void)
&pfx_1_2_3_5_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
tm->hw[0]->sw_if_index,
~0,
@@ -1659,10 +1675,10 @@ fib_test_v4 (void)
FIB_TEST_LB_BUCKET_VIA_ADJ(&pfx_1_2_3_5_s_32, 14, ai_12_12_12_12);
FIB_TEST_LB_BUCKET_VIA_ADJ(&pfx_1_2_3_5_s_32, 15, ai_12_12_12_12);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
- tm->hw[0]->sw_if_index,
- tm->hw[1]->sw_if_index),
- "RPF list for 1.2.3.4/32 contains both adjs");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
+ tm->hw[0]->sw_if_index,
+ tm->hw[1]->sw_if_index),
+ "RPF list for 1.2.3.4/32 contains both adjs");
/*
* Test UCMP with a large weight skew - this produces load-balance objects with large
@@ -1670,18 +1686,18 @@ fib_test_v4 (void)
* laso testing the LB in placce modify code when number of buckets is large.
*/
fib_prefix_t pfx_6_6_6_6_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 1.1.1.1/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x06060606),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 1.1.1.1/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x06060606),
+ },
};
fib_test_lb_bucket_t ip_o_10_10_10_1 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_01,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_01,
+ },
};
fib_test_lb_bucket_t ip_o_10_10_10_2 = {
.type = FT_LB_ADJ,
@@ -1696,23 +1712,23 @@ fib_test_v4 (void)
},
};
fib_table_entry_update_one_path(fib_index,
- &pfx_6_6_6_6_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 0, // zero weigth
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_6_6_6_6_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 0, // zero weigth
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_6_6_6_6_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_10_10_10_1),
- "6.6.6.6/32 via 10.10.10.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_10_10_10_1),
+ "6.6.6.6/32 via 10.10.10.1");
fib_table_entry_path_add(fib_index,
&pfx_6_6_6_6_s_32,
@@ -1727,74 +1743,74 @@ fib_test_v4 (void)
FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_6_6_6_6_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 64,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_1),
- "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 64,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_1),
+ "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
fib_table_entry_path_add(fib_index,
&pfx_6_6_6_6_s_32,
@@ -1809,138 +1825,138 @@ fib_test_v4 (void)
FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_6_6_6_6_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 128,
- &ip_o_10_10_10_1,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12,
- &ip_6_6_6_6_o_12_12_12_12),
- "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 128,
+ &ip_o_10_10_10_1,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12,
+ &ip_6_6_6_6_o_12_12_12_12),
+ "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
fib_table_entry_path_remove(fib_index,
&pfx_6_6_6_6_s_32,
@@ -1953,74 +1969,74 @@ fib_test_v4 (void)
FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_6_6_6_6_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 64,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_2,
- &ip_o_10_10_10_1),
- "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 64,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_2,
+ &ip_o_10_10_10_1),
+ "6.6.6.6/32 via 10.10.10.1 and 10.10.10.2 in 63:1 ratio");
fib_table_entry_path_remove(fib_index,
&pfx_6_6_6_6_s_32,
@@ -2033,11 +2049,11 @@ fib_test_v4 (void)
FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_6_6_6_6_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_10_10_10_1),
- "6.6.6.6/32 via 10.10.10.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_10_10_10_1),
+ "6.6.6.6/32 via 10.10.10.1");
fib_table_entry_delete(fib_index, &pfx_6_6_6_6_s_32, FIB_SOURCE_API);
@@ -2045,19 +2061,19 @@ fib_test_v4 (void)
* A recursive via the two unequal cost entries
*/
fib_prefix_t bgp_44_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 200.200.200.201/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x44444444),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 200.200.200.201/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x44444444),
+ },
};
fei = fib_table_entry_path_add(fib_index,
&bgp_44_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_2_3_4_s_32.fp_addr,
+ DPO_PROTO_IP4,
+ &pfx_1_2_3_4_s_32.fp_addr,
~0,
fib_index,
1,
@@ -2067,8 +2083,8 @@ fib_test_v4 (void)
&bgp_44_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_2_3_5_s_32.fp_addr,
+ DPO_PROTO_IP4,
+ &pfx_1_2_3_5_s_32.fp_addr,
~0,
fib_index,
1,
@@ -2077,10 +2093,10 @@ fib_test_v4 (void)
FIB_TEST_REC_FORW(&bgp_44_s_32, &pfx_1_2_3_4_s_32, 0);
FIB_TEST_REC_FORW(&bgp_44_s_32, &pfx_1_2_3_5_s_32, 1);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
- tm->hw[0]->sw_if_index,
- tm->hw[1]->sw_if_index),
- "RPF list for 1.2.3.4/32 contains both adjs");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 2,
+ tm->hw[0]->sw_if_index,
+ tm->hw[1]->sw_if_index),
+ "RPF list for 1.2.3.4/32 contains both adjs");
/*
* test the uRPF check functions
@@ -2092,14 +2108,14 @@ fib_test_v4 (void)
urpfi = load_balance_get_urpf(dpo_44.dpoi_index);
FIB_TEST(fib_urpf_check(urpfi, tm->hw[0]->sw_if_index),
- "uRPF check for 68.68.68.68/32 on %d OK",
- tm->hw[0]->sw_if_index);
+ "uRPF check for 68.68.68.68/32 on %d OK",
+ tm->hw[0]->sw_if_index);
FIB_TEST(fib_urpf_check(urpfi, tm->hw[1]->sw_if_index),
- "uRPF check for 68.68.68.68/32 on %d OK",
- tm->hw[1]->sw_if_index);
+ "uRPF check for 68.68.68.68/32 on %d OK",
+ tm->hw[1]->sw_if_index);
FIB_TEST(!fib_urpf_check(urpfi, 99),
- "uRPF check for 68.68.68.68/32 on 99 not-OK",
- 99);
+ "uRPF check for 68.68.68.68/32 on 99 not-OK",
+ 99);
dpo_reset(&dpo_44);
fib_table_entry_delete(fib_index,
@@ -2117,20 +2133,20 @@ fib_test_v4 (void)
* 200.200.200.201/32 via 1.1.1.200/32 => the via entry is NOT installed.
*/
fib_prefix_t bgp_201_pfx = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 200.200.200.201/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0xc8c8c8c9),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 200.200.200.201/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0xc8c8c8c9),
+ },
};
/* via 1.1.1.200 */
fib_prefix_t pfx_1_1_1_200_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x010101c8),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x010101c8),
+ },
};
fei = fib_table_entry_path_add(fib_index,
@@ -2150,44 +2166,44 @@ fib_test_v4 (void)
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_200_s_32);
FIB_TEST((FIB_ENTRY_FLAG_NONE == fib_entry_get_flags(fei)),
- "Flags set on RR via non-attached");
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
- "RPF list for BGP route empty");
+ "Flags set on RR via non-attached");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
+ "RPF list for BGP route empty");
/*
* +2 entry (BGP & RR) and +1 shared-path-list
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* insert a route that covers the missing 1.1.1.2/32. we epxect
* 200.200.200.200/32 and 200.200.200.201/32 to resolve through it.
*/
fib_prefix_t pfx_1_1_1_0_s_24 = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 1.1.1.0/24 */
- .ip4.as_u32 = clib_host_to_net_u32(0x01010100),
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 1.1.1.0/24 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010100),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_0_s_24);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
ai = fib_entry_get_adj(fei);
@@ -2205,11 +2221,11 @@ fib_test_v4 (void)
* +1 entry. 1.1.1.1/32 already uses 10.10.10.1 so no new pah-list
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+13 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* the recursive adj for 200.200.200.200 should be updated.
@@ -2217,35 +2233,35 @@ fib_test_v4 (void)
FIB_TEST_REC_FORW(&bgp_201_pfx, &pfx_1_1_1_200_s_32, 0);
FIB_TEST_REC_FORW(&bgp_200_pfx, &pfx_1_1_1_2_s_32, 0);
fei = fib_table_lookup(fib_index, &bgp_200_pfx);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
- tm->hw[0]->sw_if_index),
- "RPF list for BGP route has itf index 0");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1,
+ tm->hw[0]->sw_if_index),
+ "RPF list for BGP route has itf index 0");
/*
* insert a more specific route than 1.1.1.0/24 that also covers the
- * missing 1.1.1.2/32, but not 1.1.1.200/32. we epxect
+ * missing 1.1.1.2/32, but not 1.1.1.200/32. we expect
* 200.200.200.200 to resolve through it.
*/
fib_prefix_t pfx_1_1_1_0_s_28 = {
- .fp_len = 28,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 1.1.1.0/24 */
- .ip4.as_u32 = clib_host_to_net_u32(0x01010100),
- },
+ .fp_len = 28,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 1.1.1.0/24 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010100),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_0_s_28,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_0_s_28,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_0_s_28);
dpo2 = fib_entry_contribute_ip_forwarding(fei);
ai = fib_entry_get_adj(fei);
@@ -2255,11 +2271,11 @@ fib_test_v4 (void)
* +1 entry. +1 shared path-list
*/
FIB_TEST((5 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+9 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+14 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* the recursive adj for 200.200.200.200 should be updated.
@@ -2272,20 +2288,20 @@ fib_test_v4 (void)
* remove this /28. 200.200.200.200/32 should revert back to via 1.1.1.0/24
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_0_s_28,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_28) ==
- FIB_NODE_INDEX_INVALID),
- "1.1.1.0/28 removed");
- FIB_TEST((fib_table_lookup(fib_index, &pfx_1_1_1_0_s_28) ==
- fib_table_lookup(fib_index, &pfx_1_1_1_0_s_24)),
- "1.1.1.0/28 lookup via /24");
+ &pfx_1_1_1_0_s_28,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_28) ==
+ FIB_NODE_INDEX_INVALID),
+ "1.1.1.0/28 removed");
+ FIB_TEST((fib_table_lookup(fib_index, &pfx_1_1_1_0_s_28) ==
+ fib_table_lookup(fib_index, &pfx_1_1_1_0_s_24)),
+ "1.1.1.0/28 lookup via /24");
FIB_TEST_REC_FORW(&bgp_201_pfx, &pfx_1_1_1_200_s_32, 0);
FIB_TEST_REC_FORW(&bgp_200_pfx, &pfx_1_1_1_2_s_32, 0);
@@ -2293,34 +2309,34 @@ fib_test_v4 (void)
* -1 entry. -1 shared path-list
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+13 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* remove 1.1.1.0/24. 200.200.200.200/32 should revert back to via 0.0.0.0/0
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_0_s_24,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_24) ==
- FIB_NODE_INDEX_INVALID),
- "1.1.1.0/24 removed");
+ &pfx_1_1_1_0_s_24,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_24) ==
+ FIB_NODE_INDEX_INVALID),
+ "1.1.1.0/24 removed");
fei = fib_table_lookup(fib_index, &pfx_1_1_1_2_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "1.1.1.2/32 route is DROP");
+ "1.1.1.2/32 route is DROP");
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_200_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "1.1.1.200/32 route is DROP");
+ "1.1.1.200/32 route is DROP");
fei = fib_table_lookup_exact_match(fib_index, &bgp_201_pfx);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
@@ -2333,26 +2349,26 @@ fib_test_v4 (void)
* -1 entry
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* insert the missing 1.1.1.2/32
*/
fei = fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai = ai_01), "1.1.1.2/32 resolves via 10.10.10.1");
@@ -2366,11 +2382,11 @@ fib_test_v4 (void)
* no change. 1.1.1.2/32 was already there RR sourced.
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+12 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* give 201 a resolved path.
@@ -2403,61 +2419,61 @@ fib_test_v4 (void)
* remove 200.200.200.201/32 which does not have a valid via FIB
*/
fib_table_entry_path_remove(fib_index,
- &bgp_201_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_200_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_201_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_200_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* -2 entries (BGP and RR). -1 shared path-list;
*/
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_201_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "200.200.200.201/32 removed");
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_200_s_32) ==
- FIB_NODE_INDEX_INVALID),
- "1.1.1.200/32 removed");
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_201_pfx) ==
+ FIB_NODE_INDEX_INVALID),
+ "200.200.200.201/32 removed");
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_200_s_32) ==
+ FIB_NODE_INDEX_INVALID),
+ "1.1.1.200/32 removed");
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+7 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* remove 200.200.200.200/32 which does have a valid via FIB
*/
fib_table_entry_path_remove(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_200_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "200.200.200.200/32 removed");
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_2_s_32) !=
- FIB_NODE_INDEX_INVALID),
- "1.1.1.2/32 still present");
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_200_pfx) ==
+ FIB_NODE_INDEX_INVALID),
+ "200.200.200.200/32 removed");
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_2_s_32) !=
+ FIB_NODE_INDEX_INVALID),
+ "1.1.1.2/32 still present");
/*
* -1 entry (BGP, the RR source is also API sourced). -1 shared path-list;
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+9 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* A recursive prefix that has a 2 path load-balance.
@@ -2465,35 +2481,35 @@ fib_test_v4 (void)
* test the ref counting of RR sourced prefixes and 2 level LB.
*/
const fib_prefix_t bgp_102 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 100.100.100.101/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x64646466),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 100.100.100.101/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x64646466),
+ },
};
fib_table_entry_path_add(fib_index,
- &bgp_102,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_102,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &bgp_102,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_102,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &bgp_102);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "100.100.100.102/32 presnet");
dpo = fib_entry_contribute_ip_forwarding(fei);
@@ -2506,28 +2522,28 @@ fib_test_v4 (void)
lb = load_balance_get(dpo->dpoi_index);
FIB_TEST((lb->lb_n_buckets == 2), "Recursive LB has %d bucket", lb->lb_n_buckets);
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "First via 10.10.10.1");
+ "First via 10.10.10.1");
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket(dpo->dpoi_index, 1)),
- "Second via 10.10.10.1");
+ "Second via 10.10.10.1");
fib_table_entry_path_remove(fib_index,
- &bgp_102,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_102,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &bgp_102,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_102,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &bgp_102);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "100.100.100.102/32 removed");
@@ -2535,64 +2551,64 @@ fib_test_v4 (void)
* remove the remaining recursives
*/
fib_table_entry_path_remove(fib_index,
- &bgp_100_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_100_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &bgp_101_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_100_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "100.100.100.100/32 removed");
- FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_101_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "100.100.100.101/32 removed");
+ &bgp_101_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_100_pfx) ==
+ FIB_NODE_INDEX_INVALID),
+ "100.100.100.100/32 removed");
+ FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_101_pfx) ==
+ FIB_NODE_INDEX_INVALID),
+ "100.100.100.101/32 removed");
/*
* -2 entry (2*BGP, the RR source is also API sourced). -1 shared path-list;
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add a recursive route via a connected cover, using an adj-fib that does exist
*/
fib_table_entry_path_add(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- ~0, // no index provided.
- fib_index, // Same as route's FIB
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ ~0, // no index provided.
+ fib_index, // Same as route's FIB
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* +1 entry. +1 shared path-list (recursive via 10.10.10.1)
*/
FIB_TEST((2 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+6 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+8 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
@@ -2601,51 +2617,51 @@ fib_test_v4 (void)
dpo1 = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "200.200.200.200/32 is recursive via adj for 10.10.10.1");
+ "200.200.200.200/32 is recursive via adj for 10.10.10.1");
FIB_TEST((FIB_ENTRY_FLAG_ATTACHED == fib_entry_get_flags(fei)),
- "Flags set on RR via existing attached");
+ "Flags set on RR via existing attached");
/*
* Add a recursive route via a connected cover, using and adj-fib that does
* not exist
*/
ip46_address_t nh_10_10_10_3 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a03),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a03),
};
fib_prefix_t pfx_10_10_10_3 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = nh_10_10_10_3,
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = nh_10_10_10_3,
};
fib_table_entry_path_add(fib_index,
- &bgp_201_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_3,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_201_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* +2 entries (BGP and RR). +1 shared path-list (recursive via 10.10.10.3) and
* one unshared non-recursive via 10.10.10.3
*/
FIB_TEST((3 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
ai_03 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &nh_10_10_10_3,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index);
fei = fib_table_lookup_exact_match(fib_index, &bgp_201_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
@@ -2655,11 +2671,11 @@ fib_test_v4 (void)
ai = fib_entry_get_adj(fei);
FIB_TEST((ai == ai_03), "adj for 10.10.10.3/32 is via adj for 10.10.10.3");
FIB_TEST(((FIB_ENTRY_FLAG_ATTACHED | FIB_ENTRY_FLAG_CONNECTED) ==
- fib_entry_get_flags(fei)),
- "Flags set on RR via non-existing attached");
+ fib_entry_get_flags(fei)),
+ "Flags set on RR via non-existing attached");
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "adj for 200.200.200.200/32 is recursive via adj for 10.10.10.3");
+ "adj for 200.200.200.200/32 is recursive via adj for 10.10.10.3");
adj_unlock(ai_03);
@@ -2667,44 +2683,44 @@ fib_test_v4 (void)
* remove the recursives
*/
fib_table_entry_path_remove(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &bgp_201_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_3,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &bgp_201_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_201_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "200.200.200.201/32 removed");
+ FIB_NODE_INDEX_INVALID),
+ "200.200.200.201/32 removed");
FIB_TEST((fib_table_lookup_exact_match(fib_index, &bgp_200_pfx) ==
- FIB_NODE_INDEX_INVALID),
- "200.200.200.200/32 removed");
+ FIB_NODE_INDEX_INVALID),
+ "200.200.200.200/32 removed");
FIB_TEST((fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_3) ==
- FIB_NODE_INDEX_INVALID),
- "10.10.10.3/32 removed");
+ FIB_NODE_INDEX_INVALID),
+ "10.10.10.3/32 removed");
/*
* -3 entries (2*BGP and RR). -2 shared path-list (recursive via 10.10.10.3 &
* 10.10.10.1) and one unshared non-recursive via 10.10.10.3
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
@@ -2712,82 +2728,82 @@ fib_test_v4 (void)
* Add 5.5.5.5/32 -> 5.5.5.6/32 -> 5.5.5.7/32 -> 5.5.5.5/32
*/
fib_prefix_t pfx_5_5_5_5_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x05050505),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x05050505),
+ },
};
fib_prefix_t pfx_5_5_5_6_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x05050506),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x05050506),
+ },
};
fib_prefix_t pfx_5_5_5_7_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x05050507),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x05050507),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_5_5_5_5_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_5_5_5_6_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_5_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_6_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_5_5_5_7_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_7_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &pfx_5_5_5_7_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_5_5_5_5_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_7_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_5_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* +3 entries, +3 shared path-list
*/
FIB_TEST((4 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+8 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+10 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* All the entries have only looped paths, so they are all drop
*/
fei = fib_table_lookup(fib_index, &pfx_5_5_5_7_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.7/32 is via adj for DROP");
+ "LB for 5.5.5.7/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_5_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.5/32 is via adj for DROP");
+ "LB for 5.5.5.5/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_6_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.6/32 is via adj for DROP");
+ "LB for 5.5.5.6/32 is via adj for DROP");
/*
* provide 5.5.5.6/32 with alternate path.
@@ -2795,16 +2811,16 @@ fib_test_v4 (void)
* are still drop since the loop is still present.
*/
fib_table_entry_path_add(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_5_5_5_6_s_32);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
@@ -2815,54 +2831,54 @@ fib_test_v4 (void)
dpo2 = load_balance_get_bucket(dpo1->dpoi_index, 0);
FIB_TEST(DPO_ADJACENCY == dpo2->dpoi_type, "type is %d", dpo2->dpoi_type);
FIB_TEST((ai_01 == dpo2->dpoi_index),
- "5.5.5.6 bucket 0 resolves via 10.10.10.2");
+ "5.5.5.6 bucket 0 resolves via 10.10.10.2");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_7_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.7/32 is via adj for DROP");
+ "LB for 5.5.5.7/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_5_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.5/32 is via adj for DROP");
+ "LB for 5.5.5.5/32 is via adj for DROP");
/*
* remove the alternate path for 5.5.5.6/32
* back to all drop
*/
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_5_5_5_7_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.7/32 is via adj for DROP");
+ "LB for 5.5.5.7/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_5_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.5/32 is via adj for DROP");
+ "LB for 5.5.5.5/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_6_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.6/32 is via adj for DROP");
+ "LB for 5.5.5.6/32 is via adj for DROP");
/*
* break the loop by giving 5.5.5.5/32 a new set of paths
* expect all to forward via this new path.
*/
fib_table_entry_update_one_path(fib_index,
- &pfx_5_5_5_5_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_5_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_5_5_5_5_s_32);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
@@ -2872,7 +2888,7 @@ fib_test_v4 (void)
dpo2 = load_balance_get_bucket(dpo1->dpoi_index, 0);
FIB_TEST(DPO_ADJACENCY == dpo2->dpoi_type, "type is %d", dpo2->dpoi_type);
FIB_TEST((ai_01 == dpo2->dpoi_index),
- "5.5.5.5 bucket 0 resolves via 10.10.10.2");
+ "5.5.5.5 bucket 0 resolves via 10.10.10.2");
fei = fib_table_lookup_exact_match(fib_index, &pfx_5_5_5_7_s_32);
dpo2 = fib_entry_contribute_ip_forwarding(fei);
@@ -2880,7 +2896,7 @@ fib_test_v4 (void)
lb = load_balance_get(dpo2->dpoi_index);
FIB_TEST((lb->lb_n_buckets == 1), "Recursive LB has %d bucket", lb->lb_n_buckets);
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket(dpo2->dpoi_index, 0)),
- "5.5.5.5.7 via 5.5.5.5");
+ "5.5.5.5.7 via 5.5.5.5");
fei = fib_table_lookup_exact_match(fib_index, &pfx_5_5_5_6_s_32);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
@@ -2888,114 +2904,114 @@ fib_test_v4 (void)
lb = load_balance_get(dpo1->dpoi_index);
FIB_TEST((lb->lb_n_buckets == 1), "Recursive LB has %d bucket", lb->lb_n_buckets);
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket(dpo1->dpoi_index, 0)),
- "5.5.5.5.6 via 5.5.5.7");
+ "5.5.5.5.6 via 5.5.5.7");
/*
* revert back to the loop. so we can remove the prefixes with
* the loop intact
*/
fib_table_entry_update_one_path(fib_index,
- &pfx_5_5_5_5_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_5_5_5_6_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_5_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_6_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_5_5_5_7_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.7/32 is via adj for DROP");
+ "LB for 5.5.5.7/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_5_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.5/32 is via adj for DROP");
+ "LB for 5.5.5.5/32 is via adj for DROP");
fei = fib_table_lookup(fib_index, &pfx_5_5_5_6_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "LB for 5.5.5.6/32 is via adj for DROP");
+ "LB for 5.5.5.6/32 is via adj for DROP");
/*
* remove all the 5.5.5.x/32 prefixes
*/
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_5_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_5_5_5_6_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_5_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_6_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_5_5_5_7_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_7_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_7_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_5_5_5_5_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_7_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_5_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* -3 entries, -3 shared path-list
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Single level loop 5.5.5.5/32 via 5.5.5.5/32
*/
fib_table_entry_path_add(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_5_5_5_6_s_32.fp_addr,
- ~0, // no index provided.
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_6_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_5_5_5_6_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
- "1-level 5.5.5.6/32 loop is via adj for DROP");
-
+ "1-level 5.5.5.6/32 loop is via adj for DROP");
+
fib_table_entry_path_remove(fib_index,
- &pfx_5_5_5_6_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_5_5_5_6_s_32.fp_addr,
- ~0, // no index provided.
- fib_index, // same as route's FIB
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_5_5_5_6_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_5_5_5_6_s_32.fp_addr,
+ ~0, // no index provided.
+ fib_index, // same as route's FIB
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_5_5_5_6_s_32),
- "1-level 5.5.5.6/32 loop is removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_5_5_5_6_s_32),
+ "1-level 5.5.5.6/32 loop is removed");
/*
* A recursive route whose next-hop is covered by the prefix.
@@ -3004,70 +3020,70 @@ fib_test_v4 (void)
* via-fib, and we have a loop.
*/
fib_prefix_t pfx_23_23_23_0_s_24 = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x17171700),
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x17171700),
+ },
};
fib_prefix_t pfx_23_23_23_23_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
.ip4.as_u32 = clib_host_to_net_u32(0x17171717),
},
};
fei = fib_table_entry_path_add(fib_index,
- &pfx_23_23_23_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_23_23_23_23_s_32.fp_addr,
- ~0, // recursive
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_23_23_23_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_23_23_23_23_s_32.fp_addr,
+ ~0, // recursive
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(load_balance_is_drop(dpo),
- "23.23.23.0/24 via covered is DROP");
+ "23.23.23.0/24 via covered is DROP");
fib_table_entry_delete_index(fei, FIB_SOURCE_API);
/*
* add-remove test. no change.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Make the default route recursive via a unknown next-hop. Thus the
* next hop's cover would be the default route
*/
fei = fib_table_entry_path_add(fib_index,
- &pfx_0_0_0_0_s_0,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_23_23_23_23_s_32.fp_addr,
- ~0, // recursive
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_0_0_0_0_s_0,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_23_23_23_23_s_32.fp_addr,
+ ~0, // recursive
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(load_balance_is_drop(dpo),
- "0.0.0.0.0/0 via is DROP");
+ "0.0.0.0.0/0 via is DROP");
FIB_TEST((fib_entry_get_resolving_interface(fei) == ~0),
"no resolving interface for looped 0.0.0.0/0");
fei = fib_table_lookup_exact_match(fib_index, &pfx_23_23_23_23_s_32);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(load_balance_is_drop(dpo),
- "23.23.23.23/32 via is DROP");
+ "23.23.23.23/32 via is DROP");
FIB_TEST((fib_entry_get_resolving_interface(fei) == ~0),
"no resolving interface for looped 23.23.23.23/32");
@@ -3078,16 +3094,16 @@ fib_test_v4 (void)
* 200.200.200.200/32 via 1.1.1.1 is recurse via host constrained
*/
fib_table_entry_path_add(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_1_1_1_1,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_1_1_1_1,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_1_s_32);
dpo2 = fib_entry_contribute_ip_forwarding(fei);
@@ -3096,7 +3112,7 @@ fib_test_v4 (void)
dpo1 = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket(dpo1->dpoi_index, 0)),
- "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
+ "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
/*
* save the load-balance. we expect it to be inplace modified
@@ -3108,87 +3124,87 @@ fib_test_v4 (void)
* as the resolving route when the host is removed
*/
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_0_s_28,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_0_s_28,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_28);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai == ai_01),
- "adj for 1.1.1.0/28 is via adj for 1.1.1.1");
+ "adj for 1.1.1.0/28 is via adj for 1.1.1.1");
/*
* remove the host via FIB - expect the BGP prefix to be drop
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo1->dpoi_index, 0)),
- "adj for 200.200.200.200/32 is recursive via adj for DROP");
+ "adj for 200.200.200.200/32 is recursive via adj for DROP");
/*
* add the via-entry host reoute back. expect to resolve again
*/
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket(dpo1->dpoi_index, 0)),
- "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
+ "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
/*
* add another path for the recursive. it will then have 2.
*/
fib_prefix_t pfx_1_1_1_3_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010103),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010103),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_3_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_3_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_3_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_3_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
/*
* add a bunch load more entries using this path combo so that we get
@@ -3202,7 +3218,7 @@ fib_test_v4 (void)
bgp_78s[ii].fp_proto = FIB_PROTOCOL_IP4;
bgp_78s[ii].fp_addr.ip4.as_u32 = clib_host_to_net_u32(0x4e000000+ii);
-
+
fib_table_entry_path_add(fib_index,
&bgp_78s[ii],
FIB_SOURCE_API,
@@ -3233,11 +3249,11 @@ fib_test_v4 (void)
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_1_s_32);
dpo2 = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
+ "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.1");
fei = fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_3_s_32);
dpo1 = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket(dpo->dpoi_index, 1)),
- "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.3");
+ "adj for 200.200.200.200/32 is recursive via adj for 1.1.1.3");
/*
* expect the lb-map used by the recursive's load-balance is using both buckets
@@ -3266,25 +3282,25 @@ fib_test_v4 (void)
* inplace-modify.
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
FIB_TEST(!dpo_cmp(dpo, fib_entry_contribute_ip_forwarding(fei)),
- "post PIC 200.200.200.200/32 was inplace modified");
+ "post PIC 200.200.200.200/32 was inplace modified");
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket_i(lb, 0)),
- "post PIC adj for 200.200.200.200/32 is recursive"
- " via adj for 1.1.1.3");
+ "post PIC adj for 200.200.200.200/32 is recursive"
+ " via adj for 1.1.1.3");
/*
* the LB maps that was locked above should have been modified to remove
@@ -3301,70 +3317,70 @@ fib_test_v4 (void)
load_balance_map_unlock(lbmi);
/*
- * add it back. again
+ * add it back. again
*/
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/* suspend so the update walk kicks in */
vlib_process_suspend(vlib_get_main(), 1e-5);
FIB_TEST(!dpo_cmp(dpo2, load_balance_get_bucket_i(lb, 0)),
- "post PIC recovery adj for 200.200.200.200/32 is recursive "
- "via adj for 1.1.1.1");
+ "post PIC recovery adj for 200.200.200.200/32 is recursive "
+ "via adj for 1.1.1.1");
FIB_TEST(!dpo_cmp(dpo1, load_balance_get_bucket_i(lb, 1)),
- "post PIC recovery adj for 200.200.200.200/32 is recursive "
- "via adj for 1.1.1.3");
+ "post PIC recovery adj for 200.200.200.200/32 is recursive "
+ "via adj for 1.1.1.3");
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(lb == load_balance_get(dpo->dpoi_index),
- "post PIC 200.200.200.200/32 was inplace modified");
+ "post PIC 200.200.200.200/32 was inplace modified");
/*
- * add a 3rd path. this makes the LB 16 buckets.
+ * add a 3rd path. this makes the LB 16 buckets.
*/
fib_table_entry_path_add(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
for (ii = 0; ii < N_P; ii++)
{
fib_table_entry_path_add(fib_index,
&bgp_78s[ii],
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
}
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(lb == load_balance_get(dpo->dpoi_index),
- "200.200.200.200/32 was inplace modified for 3rd path");
+ "200.200.200.200/32 was inplace modified for 3rd path");
FIB_TEST(16 == lb->lb_n_buckets,
- "200.200.200.200/32 was inplace modified for 3rd path to 16 buckets");
+ "200.200.200.200/32 was inplace modified for 3rd path to 16 buckets");
lbmi = lb->lb_map;
load_balance_map_lock(lbmi);
@@ -3382,23 +3398,23 @@ fib_test_v4 (void)
* the first 6 buckets of the map should map to the next 6
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
fei = fib_table_lookup_exact_match(fib_index, &bgp_200_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(lb == load_balance_get(dpo->dpoi_index),
- "200.200.200.200/32 was inplace modified for 3rd path");
+ "200.200.200.200/32 was inplace modified for 3rd path");
FIB_TEST(2 == lb->lb_n_buckets,
- "200.200.200.200/32 was inplace modified for 3rd path remove to 2 buckets");
+ "200.200.200.200/32 was inplace modified for 3rd path remove to 2 buckets");
for (ii = 0; ii < 6; ii++)
{
@@ -3421,7 +3437,7 @@ fib_test_v4 (void)
&pfx_1_1_1_1_s_32,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
tm->hw[0]->sw_if_index,
~0,
@@ -3442,124 +3458,124 @@ fib_test_v4 (void)
fib_table_entry_path_remove(fib_index,
&bgp_200_pfx,
FIB_SOURCE_API,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&pfx_1_1_1_2_s_32.fp_addr,
~0,
fib_index,
1,
MPLS_LABEL_INVALID);
fib_table_entry_path_remove(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_1_1_1_1,
- ~0,
- fib_index,
- 1,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_1_1_1_1,
+ ~0,
+ fib_index,
+ 1,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
fib_table_entry_path_remove(fib_index,
- &bgp_200_pfx,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &pfx_1_1_1_3_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
+ &bgp_200_pfx,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_3_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ FIB_ROUTE_PATH_RESOLVE_VIA_HOST);
fib_table_entry_delete(fib_index,
- &pfx_1_1_1_3_s_32,
- FIB_SOURCE_API);
+ &pfx_1_1_1_3_s_32,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_1_1_1_0_s_28,
- FIB_SOURCE_API);
+ &pfx_1_1_1_0_s_28,
+ FIB_SOURCE_API);
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_28)),
- "1.1.1.1/28 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_0_s_28)),
+ "1.1.1.1/28 removed");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_3_s_32)),
- "1.1.1.3/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_3_s_32)),
+ "1.1.1.3/32 removed");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &bgp_200_pfx)),
- "200.200.200.200/32 removed");
+ fib_table_lookup_exact_match(fib_index, &bgp_200_pfx)),
+ "200.200.200.200/32 removed");
/*
* add-remove test. no change.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* A route whose paths are built up iteratively and then removed
* all at once
*/
fib_prefix_t pfx_4_4_4_4_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 4.4.4.4/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x04040404),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 4.4.4.4/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x04040404),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_add(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_3,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(FIB_NODE_INDEX_INVALID !=
- fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
- "4.4.4.4/32 present");
+ fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
+ "4.4.4.4/32 present");
fib_table_entry_delete(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
- "4.4.4.4/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
+ "4.4.4.4/32 removed");
/*
* add-remove test. no change.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* A route with multiple paths at once
@@ -3568,23 +3584,23 @@ fib_test_v4 (void)
for (ii = 0; ii < 4; ii++)
{
- fib_route_path_t r_path = {
- .frp_proto = DPO_PROTO_IP4,
- .frp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02 + ii),
- },
- .frp_sw_if_index = tm->hw[0]->sw_if_index,
- .frp_weight = 1,
- .frp_fib_index = ~0,
- };
- vec_add1(r_paths, r_path);
+ fib_route_path_t r_path = {
+ .frp_proto = DPO_PROTO_IP4,
+ .frp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02 + ii),
+ },
+ .frp_sw_if_index = tm->hw[0]->sw_if_index,
+ .frp_weight = 1,
+ .frp_fib_index = ~0,
+ };
+ vec_add1(r_paths, r_path);
}
fib_table_entry_update(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- r_paths);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ r_paths);
fei = fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "4.4.4.4/32 present");
@@ -3594,37 +3610,37 @@ fib_test_v4 (void)
FIB_TEST((lb->lb_n_buckets == 4), "4.4.4.4/32 lb over %d paths", lb->lb_n_buckets);
fib_table_entry_delete(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
- "4.4.4.4/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
+ "4.4.4.4/32 removed");
vec_free(r_paths);
/*
* add-remove test. no change.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* A route deag route
*/
fib_table_entry_path_add(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &zero_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &zero_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "4.4.4.4/32 present");
@@ -3634,36 +3650,36 @@ fib_test_v4 (void)
lookup_dpo_t *lkd = lookup_dpo_get(dpo->dpoi_index);
FIB_TEST((fib_index == lkd->lkd_fib_index),
- "4.4.4.4/32 is deag in %d %U",
+ "4.4.4.4/32 is deag in %d %U",
lkd->lkd_fib_index,
format_dpo_id, dpo, 0);
FIB_TEST((LOOKUP_INPUT_DST_ADDR == lkd->lkd_input),
- "4.4.4.4/32 is source deag in %d %U",
+ "4.4.4.4/32 is source deag in %d %U",
lkd->lkd_input,
format_dpo_id, dpo, 0);
fib_table_entry_delete(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
- "4.4.4.4/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
+ "4.4.4.4/32 removed");
vec_free(r_paths);
/*
* A route deag route in a source lookup table
*/
fib_table_entry_path_add(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &zero_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_SOURCE_LOOKUP);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &zero_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_SOURCE_LOOKUP);
fei = fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "4.4.4.4/32 present");
@@ -3673,49 +3689,49 @@ fib_test_v4 (void)
lkd = lookup_dpo_get(dpo->dpoi_index);
FIB_TEST((fib_index == lkd->lkd_fib_index),
- "4.4.4.4/32 is deag in %d %U",
+ "4.4.4.4/32 is deag in %d %U",
lkd->lkd_fib_index,
format_dpo_id, dpo, 0);
FIB_TEST((LOOKUP_INPUT_SRC_ADDR == lkd->lkd_input),
- "4.4.4.4/32 is source deag in %d %U",
+ "4.4.4.4/32 is source deag in %d %U",
lkd->lkd_input,
format_dpo_id, dpo, 0);
fib_table_entry_delete(fib_index,
- &pfx_4_4_4_4_s_32,
- FIB_SOURCE_API);
+ &pfx_4_4_4_4_s_32,
+ FIB_SOURCE_API);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
- "4.4.4.4/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_4_4_4_4_s_32),
+ "4.4.4.4/32 removed");
vec_free(r_paths);
/*
* add-remove test. no change.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+7 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Duplicate paths:
* add a recursive with duplicate paths. Expect the duplicate to be ignored.
*/
fib_prefix_t pfx_34_1_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x22010101),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x22010101),
+ },
};
fib_prefix_t pfx_34_34_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x22220101),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x22220101),
+ },
};
fei = fib_table_entry_path_add(fib_index,
&pfx_34_34_1_1_s_32,
@@ -3762,84 +3778,84 @@ fib_test_v4 (void)
* all of which are via 10.10.10.1, Itf1
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_2_0_s_24,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_2_0_s_24,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_1_s_32),
- "1.1.1.1/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_1_s_32),
+ "1.1.1.1/32 removed");
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_2_s_32),
- "1.1.1.2/32 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_1_1_1_2_s_32),
+ "1.1.1.2/32 removed");
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_1_1_2_0_s_24),
- "1.1.2.0/24 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_1_1_2_0_s_24),
+ "1.1.2.0/24 removed");
/*
* -3 entries and -1 shared path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* An attached-host route. Expect to link to the incomplete adj
*/
fib_prefix_t pfx_4_1_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 4.1.1.1/32 */
- .ip4.as_u32 = clib_host_to_net_u32(0x04010101),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 4.1.1.1/32 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x04010101),
+ },
};
fib_table_entry_path_add(fib_index,
- &pfx_4_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &zero_addr,
- tm->hw[0]->sw_if_index,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_4_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &zero_addr,
+ tm->hw[0]->sw_if_index,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_4_1_1_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "4.1.1.1/32 present");
ai = fib_entry_get_adj(fei);
ai2 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- VNET_LINK_IP4,
- &pfx_4_1_1_1_s_32.fp_addr,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP4,
+ &pfx_4_1_1_1_s_32.fp_addr,
+ tm->hw[0]->sw_if_index);
FIB_TEST((ai == ai2), "Attached-host link to incomplete ADJ");
adj_unlock(ai2);
@@ -3847,55 +3863,55 @@ fib_test_v4 (void)
* +1 entry and +1 shared path-list
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+5 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
fib_table_entry_delete(fib_index,
- &pfx_4_1_1_1_s_32,
- FIB_SOURCE_API);
+ &pfx_4_1_1_1_s_32,
+ FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+4 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+4 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* add a v6 prefix via v4 next-hops
*/
fib_prefix_t pfx_2001_s_64 = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6.as_u64[0] = clib_host_to_net_u64(0x2001000000000000),
- },
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6.as_u64[0] = clib_host_to_net_u64(0x2001000000000000),
+ },
};
fei = fib_table_entry_path_add(0, //default v6 table
- &pfx_2001_s_64,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2001_s_64,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_2001_s_64);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "2001::/64 present");
ai = fib_entry_get_adj(fei);
adj = adj_get(ai);
FIB_TEST((adj->lookup_next_index == IP_LOOKUP_NEXT_ARP),
- "2001::/64 via ARP-adj");
+ "2001::/64 via ARP-adj");
FIB_TEST((adj->ia_link == VNET_LINK_IP6),
- "2001::/64 is link type v6");
+ "2001::/64 is link type v6");
FIB_TEST((adj->ia_nh_proto == FIB_PROTOCOL_IP4),
- "2001::/64 ADJ-adj is NH proto v4");
+ "2001::/64 ADJ-adj is NH proto v4");
fib_table_entry_delete(0, &pfx_2001_s_64, FIB_SOURCE_API);
/*
@@ -3906,17 +3922,17 @@ fib_test_v4 (void)
* - the uRPF list for the default route (it's cover) is empty
*/
fei = fib_table_entry_special_add(fib_index,
- &pfx_4_1_1_1_s_32,
- FIB_SOURCE_URPF_EXEMPT,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_4_1_1_1_s_32,
+ FIB_SOURCE_URPF_EXEMPT,
+ FIB_ENTRY_FLAG_DROP);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(load_balance_is_drop(dpo),
- "uRPF exempt 4.1.1.1/32 DROP");
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1, 0),
- "uRPF list for exempt prefix has itf index 0");
+ "uRPF exempt 4.1.1.1/32 DROP");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 1, 0),
+ "uRPF list for exempt prefix has itf index 0");
fei = fib_table_lookup_exact_match(fib_index, &pfx_0_0_0_0_s_0);
- FIB_TEST(fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
- "uRPF list for 0.0.0.0/0 empty");
+ FIB_TEST(!fib_test_urpf_is_equal(fei, FIB_FORW_CHAIN_TYPE_UNICAST_IP4, 0),
+ "uRPF list for 0.0.0.0/0 empty");
fib_table_entry_delete(fib_index, &pfx_4_1_1_1_s_32, FIB_SOURCE_URPF_EXEMPT);
@@ -3924,12 +3940,12 @@ fib_test_v4 (void)
* An adj-fib that fails the refinement criteria - no connected cover
*/
fib_prefix_t pfx_12_10_10_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 12.10.10.2 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0c0a0a02),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 12.10.10.2 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0c0a0a02),
+ },
};
fib_table_entry_path_add(fib_index,
@@ -3946,24 +3962,25 @@ fib_test_v4 (void)
fei = fib_table_lookup_exact_match(fib_index, &pfx_12_10_10_2_s_32);
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(!dpo_id_is_valid(dpo),
- "no connected cover adj-fib fails refinement");
+ FIB_TEST(dpo_is_drop(dpo),
+ "no connected cover adj-fib fails refinement: %U",
+ format_dpo_id, dpo, 0);
fib_table_entry_delete(fib_index,
- &pfx_12_10_10_2_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_12_10_10_2_s_32,
+ FIB_SOURCE_ADJ);
/*
* An adj-fib that fails the refinement criteria - cover is connected
* but on a different interface
*/
fib_prefix_t pfx_10_10_10_127_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.127 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a7f),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.127 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a7f),
+ },
};
fib_table_entry_path_add(fib_index,
@@ -3980,17 +3997,17 @@ fib_test_v4 (void)
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_127_s_32);
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(!dpo_id_is_valid(dpo),
- "wrong interface adj-fib fails refinement");
+ FIB_TEST(dpo_is_drop(dpo),
+ "wrong interface adj-fib fails refinement");
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_127_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_127_s_32,
+ FIB_SOURCE_ADJ);
/*
* add a second path to an adj-fib
* this is a sumiluation of another ARP entry created
- * on an interface on which the connected prefi does not exist.
+ * on an interface on which the connected prefix does not exist.
* The second path fails refinement. Expect to forward through the
* first.
*/
@@ -4036,10 +4053,10 @@ fib_test_v4 (void)
1,
NULL,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_10_10_10_3),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_10_10_10_3),
"10.10.10.3 via 10.10.10.3/Eth0 only");
/*
@@ -4055,7 +4072,7 @@ fib_test_v4 (void)
1,
FIB_ROUTE_PATH_FLAG_NONE);
dpo = fib_entry_contribute_ip_forwarding(fei);
- FIB_TEST(!dpo_id_is_valid(dpo),
+ FIB_TEST(dpo_is_drop(dpo),
"wrong interface adj-fib fails refinement");
/*
@@ -4072,10 +4089,10 @@ fib_test_v4 (void)
1,
NULL,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_10_10_10_3),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_10_10_10_3),
"10.10.10.3 via 10.10.10.3/Eth0 only");
/*
@@ -4090,10 +4107,10 @@ fib_test_v4 (void)
fib_index,
1,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_10_10_10_3),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_10_10_10_3),
"10.10.10.3 via 10.10.10.3/Eth0 only");
/*
@@ -4161,10 +4178,10 @@ fib_test_v4 (void)
},
};
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_l2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_l2),
"10.10.10.3 via L2 on Eth0");
fib_table_entry_path_remove(fib_index,
&pfx_10_10_10_3_s_32,
@@ -4179,30 +4196,30 @@ fib_test_v4 (void)
/*
* CLEANUP
- * remove adj-fibs:
+ * remove adj-fibs:
*/
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_1_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_1_s_32,
+ FIB_SOURCE_ADJ);
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_2_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_2_s_32,
+ FIB_SOURCE_ADJ);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_1_s_32),
- "10.10.10.1/32 adj-fib removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_1_s_32),
+ "10.10.10.1/32 adj-fib removed");
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_2_s_32),
- "10.10.10.2/32 adj-fib removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_2_s_32),
+ "10.10.10.2/32 adj-fib removed");
/*
* -2 entries and -2 non-shared path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR+2 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* unlock the adjacencies for which this test provided a rewrite.
@@ -4213,7 +4230,7 @@ fib_test_v4 (void)
adj_unlock(ai_12_12_12_12);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
/*
* CLEANUP
@@ -4221,30 +4238,30 @@ fib_test_v4 (void)
*/
local_pfx.fp_len = 32;
fib_table_entry_special_remove(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
fei = fib_table_lookup(fib_index, &local_pfx);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &local_pfx),
- "10.10.10.10/32 adj-fib removed");
+ fib_table_lookup_exact_match(fib_index, &local_pfx),
+ "10.10.10.10/32 adj-fib removed");
local_pfx.fp_len = 24;
fib_table_entry_delete(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
FIB_TEST(FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &local_pfx),
- "10.10.10.10/24 adj-fib removed");
+ fib_table_lookup_exact_match(fib_index, &local_pfx),
+ "10.10.10.10/24 adj-fib removed");
/*
* -2 entries and -2 non-shared path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Last but not least, remove the VRF
@@ -4265,21 +4282,21 @@ fib_test_v4 (void)
fib_table_unlock(fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNBR-5 == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENBR-5 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
FIB_TEST((ENBR-5 == pool_elts(fib_urpf_list_pool)), "uRPF pool size is %d",
- pool_elts(fib_urpf_list_pool));
+ pool_elts(fib_urpf_list_pool));
FIB_TEST((0 == pool_elts(load_balance_map_pool)), "LB-map pool size is %d",
- pool_elts(load_balance_map_pool));
+ pool_elts(load_balance_map_pool));
FIB_TEST((lb_count == pool_elts(load_balance_pool)), "LB pool size is %d",
pool_elts(load_balance_pool));
FIB_TEST((0 == pool_elts(dvr_dpo_pool)), "L2 DPO pool size is %d",
pool_elts(dvr_dpo_pool));
- return 0;
+ return (res);
}
static int
@@ -4295,19 +4312,20 @@ fib_test_v6 (void)
const receive_dpo_t *rd;
test_main_t *tm;
u32 fib_index;
- int ii;
+ int ii, res;
+ res = 0;
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
/* via 2001:0:0:1::2 */
ip46_address_t nh_2001_2 = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000001),
- [1] = clib_host_to_net_u64(0x0000000000000002),
- },
- },
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000001),
+ [1] = clib_host_to_net_u64(0x0000000000000002),
+ },
+ },
};
tm = &test_main;
@@ -4320,30 +4338,30 @@ fib_test_v6 (void)
for (ii = 0; ii < 4; ii++)
{
- ip6_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
+ ip6_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
}
fib_prefix_t pfx_0_0 = {
- .fp_len = 0,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- {0, 0},
- },
- },
+ .fp_len = 0,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ {0, 0},
+ },
+ },
};
dfrt = fib_table_lookup(fib_index, &pfx_0_0);
FIB_TEST((FIB_NODE_INDEX_INVALID != dfrt), "default route present");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(dfrt)),
- "Default route is DROP");
+ "Default route is DROP");
dpo = fib_entry_contribute_ip_forwarding(dfrt);
FIB_TEST((dpo->dpoi_index == ip6_fib_table_fwding_lookup(
- &ip6_main,
- 1,
- &pfx_0_0.fp_addr.ip6)),
- "default-route; fwd and non-fwd tables match");
+ &ip6_main,
+ 1,
+ &pfx_0_0.fp_addr.ip6)),
+ "default-route; fwd and non-fwd tables match");
// FIXME - check specials.
@@ -4362,9 +4380,9 @@ fib_test_v6 (void)
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNPS == fib_path_list_pool_size()), "path list pool size is %d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* add interface routes.
@@ -4374,29 +4392,29 @@ fib_test_v6 (void)
* receive on 2001:0:0:1::1/128
*/
fib_prefix_t local_pfx = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000001),
- [1] = clib_host_to_net_u64(0x0000000000000001),
- },
- },
- }
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000001),
+ [1] = clib_host_to_net_u64(0x0000000000000001),
+ },
+ },
+ }
};
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP6,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached interface route present");
@@ -4405,29 +4423,29 @@ fib_test_v6 (void)
FIB_TEST((FIB_NODE_INDEX_INVALID != ai), "attached interface route adj present");
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index),
- "attached interface adj is glean");
+ "attached interface adj is glean");
FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr,
- &adj->sub_type.glean.receive_addr)),
- "attached interface adj is receive ok");
+ &adj->sub_type.glean.receive_addr)),
+ "attached interface adj is receive ok");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST((dpo->dpoi_index == ip6_fib_table_fwding_lookup(
- &ip6_main,
- 1,
- &local_pfx.fp_addr.ip6)),
- "attached-route; fwd and non-fwd tables match");
+ &ip6_main,
+ 1,
+ &local_pfx.fp_addr.ip6)),
+ "attached-route; fwd and non-fwd tables match");
local_pfx.fp_len = 128;
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP6,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "local interface route present");
@@ -4435,28 +4453,28 @@ fib_test_v6 (void)
dpo = fib_entry_contribute_ip_forwarding(fei);
dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST((DPO_RECEIVE == dpo->dpoi_type),
- "local interface adj is local");
+ "local interface adj is local");
rd = receive_dpo_get(dpo->dpoi_index);
FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr,
- &rd->rd_addr)),
- "local interface adj is receive ok");
+ &rd->rd_addr)),
+ "local interface adj is receive ok");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST((dpo->dpoi_index == ip6_fib_table_fwding_lookup(
- &ip6_main,
- 1,
- &local_pfx.fp_addr.ip6)),
- "local-route; fwd and non-fwd tables match");
+ &ip6_main,
+ 1,
+ &local_pfx.fp_addr.ip6)),
+ "local-route; fwd and non-fwd tables match");
/*
* +2 entries. +2 unshared path-lists
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB is empty");
FIB_TEST((PNPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Modify the default route to be via an adj not yet known.
@@ -4464,15 +4482,15 @@ fib_test_v6 (void)
* a higher preference to the DEFAULT_ROUTE source
*/
fib_table_entry_path_add(fib_index, &pfx_0_0,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_0_0);
FIB_TEST((fei == dfrt), "default route same index");
@@ -4480,17 +4498,17 @@ fib_test_v6 (void)
FIB_TEST((FIB_NODE_INDEX_INVALID != ai), "default route adj present");
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&nh_2001_2, &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ "adj nbr next-hop ok");
/*
* find the adj in the shared db
*/
locked_ai = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- VNET_LINK_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index);
FIB_TEST((locked_ai == ai), "ADJ NBR DB find");
adj_unlock(locked_ai);
@@ -4498,90 +4516,90 @@ fib_test_v6 (void)
* no more entires. +1 shared path-list
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+3 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* remove the API source from the default route. We expected
* the route to remain, sourced by DEFAULT_ROUTE, and hence a DROP
*/
fib_table_entry_path_remove(fib_index, &pfx_0_0,
- FIB_SOURCE_API,
- DPO_PROTO_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_API,
+ DPO_PROTO_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_0_0);
FIB_TEST((fei == dfrt), "default route same index");
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(dfrt)),
- "Default route is DROP");
+ "Default route is DROP");
/*
* no more entires. -1 shared path-list
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+2 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add an 2 ARP entry => a complete ADJ plus adj-fib.
*/
fib_prefix_t pfx_2001_1_2_s_128 = {
- .fp_len = 128,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000001),
- [1] = clib_host_to_net_u64(0x0000000000000002),
- },
- },
- }
+ .fp_len = 128,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000001),
+ [1] = clib_host_to_net_u64(0x0000000000000002),
+ },
+ },
+ }
};
fib_prefix_t pfx_2001_1_3_s_128 = {
- .fp_len = 128,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000001),
- [1] = clib_host_to_net_u64(0x0000000000000003),
- },
- },
- }
+ .fp_len = 128,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000001),
+ [1] = clib_host_to_net_u64(0x0000000000000003),
+ },
+ },
+ }
};
u8 eth_addr[] = {
- 0xde, 0xde, 0xde, 0xba, 0xba, 0xba,
+ 0xde, 0xde, 0xde, 0xba, 0xba, 0xba,
};
ai_01 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- VNET_LINK_IP6,
- &pfx_2001_1_2_s_128.fp_addr,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP6,
+ &pfx_2001_1_2_s_128.fp_addr,
+ tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_01), "adj created");
adj = adj_get(ai_01);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_2_s_128.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
adj_nbr_update_rewrite(ai_01, ADJ_NBR_REWRITE_FLAG_COMPLETE,
- fib_test_build_rewrite(eth_addr));
+ fib_test_build_rewrite(eth_addr));
FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index),
- "adj is complete");
+ "adj is complete");
FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_2_s_128.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
fib_table_entry_path_add(fib_index,
&pfx_2001_1_2_s_128,
@@ -4602,24 +4620,24 @@ fib_test_v6 (void)
eth_addr[5] = 0xb2;
ai_02 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- VNET_LINK_IP6,
- &pfx_2001_1_3_s_128.fp_addr,
- tm->hw[0]->sw_if_index);
+ VNET_LINK_IP6,
+ &pfx_2001_1_3_s_128.fp_addr,
+ tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_02), "adj created");
adj = adj_get(ai_02);
FIB_TEST((IP_LOOKUP_NEXT_ARP == adj->lookup_next_index),
- "adj is incomplete");
+ "adj is incomplete");
FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_3_s_128.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
adj_nbr_update_rewrite(ai_02, ADJ_NBR_REWRITE_FLAG_COMPLETE,
- fib_test_build_rewrite(eth_addr));
+ fib_test_build_rewrite(eth_addr));
FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index),
- "adj is complete");
+ "adj is complete");
FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_3_s_128.fp_addr,
- &adj->sub_type.nbr.next_hop)),
- "adj nbr next-hop ok");
+ &adj->sub_type.nbr.next_hop)),
+ "adj nbr next-hop ok");
FIB_TEST((ai_01 != ai_02), "ADJs are different");
fib_table_entry_path_add(fib_index,
@@ -4642,65 +4660,65 @@ fib_test_v6 (void)
* +2 entries, +2 unshread path-lists.
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+4 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+4 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add a 2 routes via the first ADJ. ensure path-list sharing
*/
fib_prefix_t pfx_2001_a_s_64 = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x200100000000000a),
- [1] = clib_host_to_net_u64(0x0000000000000000),
- },
- },
- }
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x200100000000000a),
+ [1] = clib_host_to_net_u64(0x0000000000000000),
+ },
+ },
+ }
};
fib_prefix_t pfx_2001_b_s_64 = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x200100000000000b),
- [1] = clib_host_to_net_u64(0x0000000000000000),
- },
- },
- }
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x200100000000000b),
+ [1] = clib_host_to_net_u64(0x0000000000000000),
+ },
+ },
+ }
};
fib_table_entry_path_add(fib_index,
- &pfx_2001_a_s_64,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2001_a_s_64,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_2001_a_s_64);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "2001::a/64 resolves via 2001:0:0:1::1");
fib_table_entry_path_add(fib_index,
- &pfx_2001_b_s_64,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2001_b_s_64,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_2001_b_s_64);
ai = fib_entry_get_adj(fei);
FIB_TEST((ai_01 == ai), "2001::b/64 resolves via 2001:0:0:1::1");
@@ -4709,87 +4727,87 @@ fib_test_v6 (void)
* +2 entries, +1 shared path-list.
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+6 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* add a v4 prefix via a v6 next-hop
*/
fib_prefix_t pfx_1_1_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = 0x01010101,
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = 0x01010101,
+ },
};
fei = fib_table_entry_path_add(0, // default table
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP6,
- &nh_2001_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP6,
+ &nh_2001_2,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST(fei == fib_table_lookup_exact_match(0, &pfx_1_1_1_1_s_32),
- "1.1.1.1/32 o v6 route present");
+ "1.1.1.1/32 o v6 route present");
ai = fib_entry_get_adj(fei);
adj = adj_get(ai);
FIB_TEST((adj->lookup_next_index == IP_LOOKUP_NEXT_ARP),
- "1.1.1.1/32 via ARP-adj");
+ "1.1.1.1/32 via ARP-adj");
FIB_TEST((adj->ia_link == VNET_LINK_IP4),
- "1.1.1.1/32 ADJ-adj is link type v4");
+ "1.1.1.1/32 ADJ-adj is link type v4");
FIB_TEST((adj->ia_nh_proto == FIB_PROTOCOL_IP6),
- "1.1.1.1/32 ADJ-adj is NH proto v6");
+ "1.1.1.1/32 ADJ-adj is NH proto v6");
fib_table_entry_delete(0, &pfx_1_1_1_1_s_32, FIB_SOURCE_API);
/*
* An attached route
*/
fib_prefix_t pfx_2001_c_s_64 = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x200100000000000c),
- [1] = clib_host_to_net_u64(0x0000000000000000),
- },
- },
- }
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x200100000000000c),
+ [1] = clib_host_to_net_u64(0x0000000000000000),
+ },
+ },
+ }
};
fib_table_entry_path_add(fib_index,
- &pfx_2001_c_s_64,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_ATTACHED,
- DPO_PROTO_IP6,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2001_c_s_64,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_ATTACHED,
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_c_s_64);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached route present");
ai = fib_entry_get_adj(fei);
adj = adj_get(ai);
FIB_TEST((adj->lookup_next_index == IP_LOOKUP_NEXT_GLEAN),
- "2001:0:0:c/64 attached resolves via glean");
+ "2001:0:0:c/64 attached resolves via glean");
fib_table_entry_path_remove(fib_index,
- &pfx_2001_c_s_64,
- FIB_SOURCE_CLI,
- DPO_PROTO_IP6,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2001_c_s_64,
+ FIB_SOURCE_CLI,
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_c_s_64);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "attached route removed");
@@ -4802,80 +4820,80 @@ fib_test_v6 (void)
clib_error_t * error;
error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[0]->sw_if_index,
- ~VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[0]->sw_if_index,
+ ~VNET_SW_INTERFACE_FLAG_ADMIN_UP);
FIB_TEST((NULL == error), "Interface shutdown OK");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001::b/64 resolves via drop");
+ "2001::b/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001::a/64 resolves via drop");
+ "2001::a/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_1_3_s_128);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::3/64 resolves via drop");
+ "2001:0:0:1::3/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_1_2_s_128);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::2/64 resolves via drop");
+ "2001:0:0:1::2/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::1/128 not drop");
+ "2001:0:0:1::1/128 not drop");
local_pfx.fp_len = 64;
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1/64 resolves via drop");
+ "2001:0:0:1/64 resolves via drop");
/*
* no change
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+5 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+6 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* shutdown one of the other interfaces, then add a connected.
* and swap one of the routes to it.
*/
error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[1]->sw_if_index,
- ~VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[1]->sw_if_index,
+ ~VNET_SW_INTERFACE_FLAG_ADMIN_UP);
FIB_TEST((NULL == error), "Interface 1 shutdown OK");
fib_prefix_t connected_pfx = {
- .fp_len = 64,
- .fp_proto = FIB_PROTOCOL_IP6,
- .fp_addr = {
- .ip6 = {
- /* 2001:0:0:2::1/64 */
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000002),
- [1] = clib_host_to_net_u64(0x0000000000000001),
- },
- },
- }
+ .fp_len = 64,
+ .fp_proto = FIB_PROTOCOL_IP6,
+ .fp_addr = {
+ .ip6 = {
+ /* 2001:0:0:2::1/64 */
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000002),
+ [1] = clib_host_to_net_u64(0x0000000000000001),
+ },
+ },
+ }
};
fib_table_entry_update_one_path(fib_index, &connected_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP6,
- NULL,
- tm->hw[1]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[1]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &connected_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached interface route present");
dpo = fib_entry_contribute_ip_forwarding(fei);
@@ -4885,37 +4903,37 @@ fib_test_v6 (void)
connected_pfx.fp_len = 128;
fib_table_entry_update_one_path(fib_index, &connected_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP6,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP6,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &connected_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "local interface route present");
dpo = fib_entry_contribute_ip_forwarding(fei);
dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
FIB_TEST((DPO_RECEIVE == dpo->dpoi_type),
- "local interface adj is local");
+ "local interface adj is local");
rd = receive_dpo_get(dpo->dpoi_index);
FIB_TEST((0 == ip46_address_cmp(&connected_pfx.fp_addr,
- &rd->rd_addr)),
- "local interface adj is receive ok");
+ &rd->rd_addr)),
+ "local interface adj is receive ok");
/*
* +2 entries, +2 unshared path-lists
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+8 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
@@ -4923,8 +4941,8 @@ fib_test_v6 (void)
* to normal forwarding.
*/
error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[0]->sw_if_index,
- VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[0]->sw_if_index,
+ VNET_SW_INTERFACE_FLAG_ADMIN_UP);
FIB_TEST((NULL == error), "Interface bring-up OK");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64);
ai = fib_entry_get_adj(fei);
@@ -4943,46 +4961,46 @@ fib_test_v6 (void)
ai = fib_entry_get_adj(fei);
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index),
- "attached interface adj is glean");
+ "attached interface adj is glean");
/*
* Same test as above, but this time the HW interface goes down
*/
error = vnet_hw_interface_set_flags(vnet_get_main(),
- tm->hw_if_indicies[0],
- ~VNET_HW_INTERFACE_FLAG_LINK_UP);
+ tm->hw_if_indicies[0],
+ ~VNET_HW_INTERFACE_FLAG_LINK_UP);
FIB_TEST((NULL == error), "Interface shutdown OK");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001::b/64 resolves via drop");
+ "2001::b/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001::a/64 resolves via drop");
+ "2001::a/64 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_1_3_s_128);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::3/128 resolves via drop");
+ "2001:0:0:1::3/128 resolves via drop");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_1_2_s_128);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::2/128 resolves via drop");
+ "2001:0:0:1::2/128 resolves via drop");
local_pfx.fp_len = 128;
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1::1/128 not drop");
+ "2001:0:0:1::1/128 not drop");
local_pfx.fp_len = 64;
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(!dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "2001:0:0:1/64 resolves via drop");
+ "2001:0:0:1/64 resolves via drop");
error = vnet_hw_interface_set_flags(vnet_get_main(),
- tm->hw_if_indicies[0],
- VNET_HW_INTERFACE_FLAG_LINK_UP);
+ tm->hw_if_indicies[0],
+ VNET_HW_INTERFACE_FLAG_LINK_UP);
FIB_TEST((NULL == error), "Interface bring-up OK");
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64);
ai = fib_entry_get_adj(fei);
@@ -5001,7 +5019,7 @@ fib_test_v6 (void)
ai = fib_entry_get_adj(fei);
adj = adj_get(ai);
FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index),
- "attached interface adj is glean");
+ "attached interface adj is glean");
/*
* Delete the interface that the routes reolve through.
@@ -5037,21 +5055,21 @@ fib_test_v6 (void)
* no change
*/
FIB_TEST((1 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS+7 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS+8 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* Add the interface back. routes stay unresolved.
*/
error = ethernet_register_interface(vnet_get_main(),
- test_interface_device_class.index,
- 0 /* instance */,
- hw_address,
- &tm->hw_if_indicies[0],
- /* flag change */ 0);
+ test_interface_device_class.index,
+ 0 /* instance */,
+ hw_address,
+ &tm->hw_if_indicies[0],
+ /* flag change */ 0);
fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
@@ -5077,71 +5095,71 @@ fib_test_v6 (void)
* CLEANUP ALL the routes
*/
fib_table_entry_delete(fib_index,
- &pfx_2001_c_s_64,
- FIB_SOURCE_API);
+ &pfx_2001_c_s_64,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_2001_a_s_64,
- FIB_SOURCE_API);
+ &pfx_2001_a_s_64,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_2001_b_s_64,
- FIB_SOURCE_API);
+ &pfx_2001_b_s_64,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_2001_1_3_s_128,
- FIB_SOURCE_ADJ);
+ &pfx_2001_1_3_s_128,
+ FIB_SOURCE_ADJ);
fib_table_entry_delete(fib_index,
- &pfx_2001_1_2_s_128,
- FIB_SOURCE_ADJ);
+ &pfx_2001_1_2_s_128,
+ FIB_SOURCE_ADJ);
local_pfx.fp_len = 64;
fib_table_entry_delete(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
local_pfx.fp_len = 128;
fib_table_entry_special_remove(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
connected_pfx.fp_len = 64;
fib_table_entry_delete(fib_index, &connected_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
connected_pfx.fp_len = 128;
fib_table_entry_special_remove(fib_index, &connected_pfx,
- FIB_SOURCE_INTERFACE);
+ FIB_SOURCE_INTERFACE);
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64)),
- "2001::a/64 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_2001_a_s_64)),
+ "2001::a/64 removed");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64)),
- "2001::b/64 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64)),
+ "2001::b/64 removed");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_2001_1_3_s_128)),
- "2001:0:0:1::3/128 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_2001_1_3_s_128)),
+ "2001:0:0:1::3/128 removed");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &pfx_2001_1_2_s_128)),
- "2001:0:0:1::3/128 removed");
+ fib_table_lookup_exact_match(fib_index, &pfx_2001_1_2_s_128)),
+ "2001:0:0:1::3/128 removed");
local_pfx.fp_len = 64;
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &local_pfx)),
- "2001:0:0:1/64 removed");
+ fib_table_lookup_exact_match(fib_index, &local_pfx)),
+ "2001:0:0:1/64 removed");
local_pfx.fp_len = 128;
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &local_pfx)),
- "2001:0:0:1::1/128 removed");
+ fib_table_lookup_exact_match(fib_index, &local_pfx)),
+ "2001:0:0:1::1/128 removed");
connected_pfx.fp_len = 64;
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &connected_pfx)),
- "2001:0:0:2/64 removed");
+ fib_table_lookup_exact_match(fib_index, &connected_pfx)),
+ "2001:0:0:2/64 removed");
connected_pfx.fp_len = 128;
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup_exact_match(fib_index, &connected_pfx)),
- "2001:0:0:2::1/128 removed");
+ fib_table_lookup_exact_match(fib_index, &connected_pfx)),
+ "2001:0:0:2::1/128 removed");
/*
* -8 entries. -7 path-lists (1 was shared).
*/
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
/*
* now remove the VRF
@@ -5149,11 +5167,11 @@ fib_test_v6 (void)
fib_table_unlock(fib_index, FIB_PROTOCOL_IP6, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
- fib_path_list_db_size());
+ fib_path_list_db_size());
FIB_TEST((PNPS-2 == fib_path_list_pool_size()), "path list pool size is%d",
- fib_path_list_pool_size());
+ fib_path_list_pool_size());
FIB_TEST((ENPS-2 == fib_entry_pool_size()), "entry pool size is %d",
- fib_entry_pool_size());
+ fib_entry_pool_size());
adj_unlock(ai_02);
adj_unlock(ai_01);
@@ -5162,16 +5180,16 @@ fib_test_v6 (void)
* return the interfaces to up state
*/
error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[0]->sw_if_index,
- VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[0]->sw_if_index,
+ VNET_SW_INTERFACE_FLAG_ADMIN_UP);
error = vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[1]->sw_if_index,
- VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[1]->sw_if_index,
+ VNET_SW_INTERFACE_FLAG_ADMIN_UP);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
- return (0);
+ return (res);
}
/*
@@ -5185,26 +5203,28 @@ fib_test_ae (void)
fib_node_index_t fei;
test_main_t *tm;
ip4_main_t *im;
+ int res;
+ res = 0;
tm = &test_main;
im = &ip4_main;
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
/*
* add interface routes. We'll assume this works. It's more rigorously
* tested elsewhere.
*/
fib_prefix_t local_pfx = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- /* 10.10.10.10 */
- .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
- },
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ /* 10.10.10.10 */
+ .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
+ },
+ },
};
vec_validate(im->fib_index_by_sw_if_index, tm->hw[0]->sw_if_index);
@@ -5213,47 +5233,47 @@ fib_test_ae (void)
dpo_drop = drop_dpo_get(DPO_PROTO_IP4);
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "attached interface route present");
+ "attached interface route present");
local_pfx.fp_len = 32;
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "local interface route present");
+ "local interface route present");
/*
* Add an 2 ARP entry => a complete ADJ plus adj-fib.
*/
fib_prefix_t pfx_10_10_10_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.1 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.1 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ },
};
fib_node_index_t ai;
@@ -5287,16 +5307,16 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(import_fib_index1,
- &local_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &local_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(import_fib_index1, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached export created");
@@ -5306,7 +5326,7 @@ fib_test_ae (void)
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib1 imported");
FIB_TEST((ai == fib_entry_get_adj(fei)),
- "adj-fib1 Import uses same adj as export");
+ "adj-fib1 Import uses same adj as export");
/*
* check for the presence of the local in the import table
@@ -5320,12 +5340,12 @@ fib_test_ae (void)
* to get magically exported;
*/
fib_prefix_t pfx_10_10_10_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.2 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.2 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
+ },
};
fib_table_entry_path_add(fib_index,
@@ -5346,7 +5366,7 @@ fib_test_ae (void)
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_2_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib2 imported");
FIB_TEST((ai == fib_entry_get_adj(fei)),
- "Import uses same adj as export");
+ "Import uses same adj as export");
FIB_TEST((FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags(fei)),
"ADJ-fib2 imported flags %d",
fib_entry_get_flags(fei));
@@ -5364,16 +5384,16 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(import_fib_index2,
- &local_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &local_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(import_fib_index1, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached export created");
@@ -5392,12 +5412,12 @@ fib_test_ae (void)
* add a 3rd adj-fib. expect it to be exported to both tables.
*/
fib_prefix_t pfx_10_10_10_3_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.10.10.3 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a03),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.10.10.3 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a03),
+ },
};
fib_table_entry_path_add(fib_index,
@@ -5418,18 +5438,18 @@ fib_test_ae (void)
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_3_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib3 imported to FIB1");
FIB_TEST((ai == fib_entry_get_adj(fei)),
- "Import uses same adj as export");
+ "Import uses same adj as export");
fei = fib_table_lookup_exact_match(import_fib_index2, &pfx_10_10_10_3_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib3 imported to FIB2");
FIB_TEST((ai == fib_entry_get_adj(fei)),
- "Import uses same adj as export");
+ "Import uses same adj as export");
/*
* remove the 3rd adj fib. we expect it to be removed from both FIBs
*/
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_3_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_3_s_32,
+ FIB_SOURCE_ADJ);
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_3_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "ADJ-fib3 remved");
@@ -5446,8 +5466,8 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_delete(import_fib_index2,
- &local_pfx,
- FIB_SOURCE_API);
+ &local_pfx,
+ FIB_SOURCE_API);
fei = fib_table_lookup_exact_match(import_fib_index2, &local_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "attached export removed");
@@ -5473,16 +5493,16 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(import_fib_index1,
- &local_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_10_10_10_2_s_32.fp_addr,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &local_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_10_10_10_2_s_32.fp_addr,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "ADJ-fib1 removed from FIB1");
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_2_s_32);
@@ -5496,16 +5516,16 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(import_fib_index1,
- &local_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &local_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib1 imported in FIB1");
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_2_s_32);
@@ -5519,19 +5539,19 @@ fib_test_ae (void)
* a valid adj to find when we check the forwarding tables
*/
fib_prefix_t pfx_10_0_0_0_s_8 = {
- .fp_len = 8,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- /* 10.0.0.0 */
- .ip4.as_u32 = clib_host_to_net_u32(0x0a000000),
- },
+ .fp_len = 8,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ /* 10.0.0.0 */
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a000000),
+ },
};
fei = fib_table_entry_update_one_path(fib_index,
&pfx_10_0_0_0_s_8,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&pfx_10_10_10_3_s_32.fp_addr,
tm->hw[0]->sw_if_index,
~0, // invalid fib index
@@ -5545,8 +5565,8 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_delete(fib_index,
- &local_pfx,
- FIB_SOURCE_INTERFACE);
+ &local_pfx,
+ FIB_SOURCE_INTERFACE);
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID == fei), "Delete export: ADJ-fib1 removed from FIB1");
@@ -5587,7 +5607,7 @@ fib_test_ae (void)
&local_pfx,
FIB_SOURCE_API,
FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ DPO_PROTO_IP4,
&pfx_10_10_10_1_s_32.fp_addr,
tm->hw[0]->sw_if_index,
~0, // invalid fib index
@@ -5620,22 +5640,22 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(fib_index,
- &local_pfx,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &local_pfx,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib1 reinstalled in export");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "Adj-fib1 is not drop in export");
+ "Adj-fib1 is not drop in export");
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_2_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib2 reinstalled in export");
local_pfx.fp_len = 32;
@@ -5645,7 +5665,9 @@ fib_test_ae (void)
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached in export: ADJ-fib1 imported");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "Adj-fib1 is not drop in export");
+ "Adj-fib1 is not drop in export: %U %U",
+ format_dpo_id, dpo, 0,
+ format_dpo_id, load_balance_get_bucket(dpo->dpoi_index, 0), 0);
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib1 imported");
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_2_s_32);
@@ -5659,22 +5681,22 @@ fib_test_ae (void)
*/
local_pfx.fp_len = 24;
fib_table_entry_update_one_path(fib_index, &local_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib1 reinstalled in export");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "Adj-fib1 is not drop in export");
+ "Adj-fib1 is not drop in export");
fei = fib_table_lookup_exact_match(fib_index, &pfx_10_10_10_2_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib2 reinstalled in export");
local_pfx.fp_len = 32;
@@ -5684,7 +5706,7 @@ fib_test_ae (void)
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "attached in export: ADJ-fib1 imported");
dpo = fib_entry_contribute_ip_forwarding(fei);
FIB_TEST(dpo_cmp(dpo_drop, load_balance_get_bucket(dpo->dpoi_index, 0)),
- "Adj-fib1 is not drop in export");
+ "Adj-fib1 is not drop in export");
fei = fib_table_lookup_exact_match(import_fib_index1, &pfx_10_10_10_2_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "ADJ-fib2 imported");
local_pfx.fp_len = 32;
@@ -5698,34 +5720,34 @@ fib_test_ae (void)
&pfx_10_0_0_0_s_8,
FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_1_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_1_s_32,
+ FIB_SOURCE_ADJ);
fib_table_entry_delete(fib_index,
- &pfx_10_10_10_2_s_32,
- FIB_SOURCE_ADJ);
+ &pfx_10_10_10_2_s_32,
+ FIB_SOURCE_ADJ);
local_pfx.fp_len = 32;
fib_table_entry_delete(fib_index,
- &local_pfx,
- FIB_SOURCE_INTERFACE);
+ &local_pfx,
+ FIB_SOURCE_INTERFACE);
local_pfx.fp_len = 24;
fib_table_entry_delete(fib_index,
- &local_pfx,
- FIB_SOURCE_API);
+ &local_pfx,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &local_pfx,
- FIB_SOURCE_INTERFACE);
+ &local_pfx,
+ FIB_SOURCE_INTERFACE);
local_pfx.fp_len = 24;
fib_table_entry_delete(import_fib_index1,
- &local_pfx,
- FIB_SOURCE_API);
+ &local_pfx,
+ FIB_SOURCE_API);
fib_table_unlock(import_fib_index1, FIB_PROTOCOL_IP4, FIB_SOURCE_CLI);
fib_table_unlock(import_fib_index2, FIB_PROTOCOL_IP4, FIB_SOURCE_CLI);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
- return (0);
+ return (res);
}
/*
@@ -5735,7 +5757,9 @@ static int
fib_test_pref (void)
{
test_main_t *tm = &test_main;
+ int res;
+ res = 0;
const fib_prefix_t pfx_1_1_1_1_s_32 = {
.fp_len = 32,
.fp_proto = FIB_PROTOCOL_IP4,
@@ -5894,11 +5918,11 @@ fib_test_pref (void)
FIB_ENTRY_FLAG_NONE,
nr_paths);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &ip_hi_1,
- &ip_hi_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &ip_hi_1,
+ &ip_hi_2),
"1.1.1.1/32 via high preference paths");
/*
@@ -5908,11 +5932,11 @@ fib_test_pref (void)
tm->hw[0]->sw_if_index,
0);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &ip_med_1,
- &ip_med_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &ip_med_1,
+ &ip_med_2),
"1.1.1.1/32 via medium preference paths");
/*
@@ -5922,11 +5946,11 @@ fib_test_pref (void)
tm->hw[1]->sw_if_index,
0);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &ip_low_1,
- &ip_low_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &ip_low_1,
+ &ip_low_2),
"1.1.1.1/32 via low preference paths");
/*
@@ -5936,11 +5960,11 @@ fib_test_pref (void)
tm->hw[0]->sw_if_index,
VNET_SW_INTERFACE_FLAG_ADMIN_UP);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &ip_hi_1,
- &ip_hi_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &ip_hi_1,
+ &ip_hi_2),
"1.1.1.1/32 via high preference paths");
/*
@@ -5950,11 +5974,11 @@ fib_test_pref (void)
tm->hw[1]->sw_if_index,
VNET_SW_INTERFACE_FLAG_ADMIN_UP);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &ip_hi_1,
- &ip_hi_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &ip_hi_1,
+ &ip_hi_2),
"1.1.1.1/32 via high preference paths");
dpo_id_t ip_1_1_1_1 = DPO_INVALID;
@@ -6056,7 +6080,7 @@ fib_test_pref (void)
/*
* add many recursive so we get the LB MAp created
*/
- #define N_PFXS 64
+#define N_PFXS 64
fib_prefix_t pfx_r[N_PFXS];
unsigned int n_pfxs;
for (n_pfxs = 0; n_pfxs < N_PFXS; n_pfxs++)
@@ -6072,10 +6096,10 @@ fib_test_pref (void)
FIB_ENTRY_FLAG_NONE,
r_paths);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_1),
"recursive via high preference paths");
/*
@@ -6088,10 +6112,10 @@ fib_test_pref (void)
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_2),
"recursive via medium preference paths");
/*
@@ -6104,10 +6128,10 @@ fib_test_pref (void)
/* suspend so the update walk kicks int */
vlib_process_suspend(vlib_get_main(), 1e-5);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_3),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_3),
"recursive via low preference paths");
/*
@@ -6128,10 +6152,10 @@ fib_test_pref (void)
vlib_process_suspend(vlib_get_main(), 1e-5);
fei = fib_table_lookup_exact_match(0, &pfx_r[n_pfxs]);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_1),
"recursive via high preference paths");
}
@@ -6147,10 +6171,10 @@ fib_test_pref (void)
{
fei = fib_table_lookup_exact_match(0, &pfx_r[n_pfxs]);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_2),
"recursive via medium preference paths");
}
for (n_pfxs = 0; n_pfxs < N_PFXS; n_pfxs++)
@@ -6179,7 +6203,8 @@ fib_test_pref (void)
adj_unlock(ai_med_1);
adj_unlock(ai_hi_2);
adj_unlock(ai_hi_1);
- return (0);
+
+ return (res);
}
/*
@@ -6190,10 +6215,11 @@ fib_test_label (void)
{
fib_node_index_t fei, ai_mpls_10_10_10_1, ai_v4_10_10_11_1, ai_v4_10_10_11_2, ai_mpls_10_10_11_2, ai_mpls_10_10_11_1;
const u32 fib_index = 0;
+ int lb_count, ii, res;
test_main_t *tm;
ip4_main_t *im;
- int lb_count, ii;
+ res = 0;
lb_count = pool_elts(load_balance_pool);
tm = &test_main;
im = &ip4_main;
@@ -6203,114 +6229,114 @@ fib_test_label (void)
* tested elsewhere.
*/
fib_prefix_t local0_pfx = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- /* 10.10.10.10 */
- .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
- },
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ /* 10.10.10.10 */
+ .as_u32 = clib_host_to_net_u32(0x0a0a0a0a),
+ },
+ },
};
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
vec_validate(im->fib_index_by_sw_if_index, tm->hw[0]->sw_if_index);
im->fib_index_by_sw_if_index[tm->hw[0]->sw_if_index] = fib_index;
fib_table_entry_update_one_path(fib_index, &local0_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local0_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "attached interface route present");
+ "attached interface route present");
local0_pfx.fp_len = 32;
fib_table_entry_update_one_path(fib_index, &local0_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local0_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "local interface route present");
+ "local interface route present");
fib_prefix_t local1_pfx = {
- .fp_len = 24,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4 = {
- /* 10.10.11.10 */
- .as_u32 = clib_host_to_net_u32(0x0a0a0b0a),
- },
- },
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ /* 10.10.11.10 */
+ .as_u32 = clib_host_to_net_u32(0x0a0a0b0a),
+ },
+ },
};
vec_validate(im->fib_index_by_sw_if_index, tm->hw[1]->sw_if_index);
im->fib_index_by_sw_if_index[tm->hw[1]->sw_if_index] = fib_index;
fib_table_entry_update_one_path(fib_index, &local1_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[1]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[1]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local1_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "attached interface route present");
+ "attached interface route present");
local1_pfx.fp_len = 32;
fib_table_entry_update_one_path(fib_index, &local1_pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_LOCAL),
- DPO_PROTO_IP4,
- NULL,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_LOCAL),
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(fib_index, &local1_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei),
- "local interface route present");
+ "local interface route present");
ip46_address_t nh_10_10_10_1 = {
- .ip4 = {
- .as_u32 = clib_host_to_net_u32(0x0a0a0a01),
- },
+ .ip4 = {
+ .as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ },
};
ip46_address_t nh_10_10_11_1 = {
- .ip4 = {
- .as_u32 = clib_host_to_net_u32(0x0a0a0b01),
- },
+ .ip4 = {
+ .as_u32 = clib_host_to_net_u32(0x0a0a0b01),
+ },
};
ip46_address_t nh_10_10_11_2 = {
- .ip4 = {
- .as_u32 = clib_host_to_net_u32(0x0a0a0b02),
- },
+ .ip4 = {
+ .as_u32 = clib_host_to_net_u32(0x0a0a0b02),
+ },
};
ai_v4_10_10_11_1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
@@ -6338,27 +6364,27 @@ fib_test_label (void)
* Add an etry with one path with a real out-going label
*/
fib_prefix_t pfx_1_1_1_1_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010101),
+ },
};
fib_test_lb_bucket_t l99_eos_o_10_10_10_1 = {
- .type = FT_LB_LABEL_O_ADJ,
- .label_o_adj = {
- .adj = ai_mpls_10_10_10_1,
- .label = 99,
- .eos = MPLS_EOS,
- },
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_mpls_10_10_10_1,
+ .label = 99,
+ .eos = MPLS_EOS,
+ },
};
fib_test_lb_bucket_t l99_neos_o_10_10_10_1 = {
- .type = FT_LB_LABEL_O_ADJ,
- .label_o_adj = {
- .adj = ai_mpls_10_10_10_1,
- .label = 99,
- .eos = MPLS_NON_EOS,
- },
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_mpls_10_10_10_1,
+ .label = 99,
+ .eos = MPLS_NON_EOS,
+ },
};
fib_mpls_label_t *l99 = NULL, fml99 = {
.fml_value = 99,
@@ -6366,40 +6392,40 @@ fib_test_label (void)
vec_add1(l99, fml99);
fib_table_entry_update_one_path(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l99,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l99,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "1.1.1.1/32 created");
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &l99_eos_o_10_10_10_1),
- "1.1.1.1/32 LB 1 bucket via label 99 over 10.10.10.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_eos_o_10_10_10_1),
+ "1.1.1.1/32 LB 1 bucket via label 99 over 10.10.10.1");
/*
* add a path with an implicit NULL label
*/
fib_test_lb_bucket_t a_o_10_10_11_1 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_v4_10_10_11_1,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_v4_10_10_11_1,
+ },
};
fib_test_lb_bucket_t a_mpls_o_10_10_11_1 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_mpls_10_10_11_1,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_mpls_10_10_11_1,
+ },
};
fib_mpls_label_t *l_imp_null = NULL, fml_imp_null = {
.fml_value = MPLS_IETF_IMPLICIT_NULL_LABEL,
@@ -6407,42 +6433,42 @@ fib_test_label (void)
vec_add1(l_imp_null, fml_imp_null);
fei = fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_11_1,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l_imp_null,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &l99_eos_o_10_10_10_1,
- &a_o_10_10_11_1),
- "1.1.1.1/32 LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj over 10.10.11.1");
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l_imp_null,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &a_o_10_10_11_1),
+ "1.1.1.1/32 LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj over 10.10.11.1");
/*
* assign the route a local label
*/
fib_table_entry_local_label_add(fib_index,
- &pfx_1_1_1_1_s_32,
- 24001);
+ &pfx_1_1_1_1_s_32,
+ 24001);
fib_prefix_t pfx_24001_eos = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 24001,
- .fp_eos = MPLS_EOS,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 24001,
+ .fp_eos = MPLS_EOS,
};
fib_prefix_t pfx_24001_neos = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 24001,
- .fp_eos = MPLS_NON_EOS,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 24001,
+ .fp_eos = MPLS_NON_EOS,
};
fib_test_lb_bucket_t disp_o_10_10_11_1 = {
.type = FT_LB_MPLS_DISP_PIPE_O_ADJ,
@@ -6458,36 +6484,36 @@ fib_test_label (void)
* and use an mpls adj for the imp-null
*/
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &l99_eos_o_10_10_10_1,
- &disp_o_10_10_11_1),
- "24001/eos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "mpls disp adj over 10.10.11.1");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &disp_o_10_10_11_1),
+ "24001/eos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "mpls disp adj over 10.10.11.1");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 2,
- &l99_neos_o_10_10_10_1,
- &a_mpls_o_10_10_11_1),
- "24001/neos LB 1 bucket via: "
- "label 99 over 10.10.10.1 ",
- "mpls-adj via 10.10.11.1");
+ &pfx_24001_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 2,
+ &l99_neos_o_10_10_10_1,
+ &a_mpls_o_10_10_11_1),
+ "24001/neos LB 1 bucket via: "
+ "label 99 over 10.10.10.1 ",
+ "mpls-adj via 10.10.11.1");
/*
* add an unlabelled path, this is excluded from the neos chains,
*/
fib_test_lb_bucket_t adj_o_10_10_11_2 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_v4_10_10_11_2,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_v4_10_10_11_2,
+ },
};
fib_test_lb_bucket_t disp_o_10_10_11_2 = {
.type = FT_LB_MPLS_DISP_PIPE_O_ADJ,
@@ -6498,73 +6524,73 @@ fib_test_label (void)
fei = fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_11_2,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 16, // 3 choices spread over 16 buckets
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 16 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj over 10.10.11.1",
- "adj over 10.10.11.2");
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_2,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 16, // 3 choices spread over 16 buckets
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 16 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj over 10.10.11.1",
+ "adj over 10.10.11.2");
/*
* get and lock a reference to the non-eos of the via entry 1.1.1.1/32
*/
dpo_id_t non_eos_1_1_1_1 = DPO_INVALID;
fib_entry_contribute_forwarding(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &non_eos_1_1_1_1);
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &non_eos_1_1_1_1);
/*
* n-eos has only the 2 labelled paths
*/
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
+ &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 2,
- &l99_neos_o_10_10_10_1,
- &a_mpls_o_10_10_11_1),
- "24001/neos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj-mpls over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 2,
+ &l99_neos_o_10_10_10_1,
+ &a_mpls_o_10_10_11_1),
+ "24001/neos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj-mpls over 10.10.11.2");
/*
* A labelled recursive
*/
fib_prefix_t pfx_2_2_2_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020202),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020202),
+ },
};
fib_test_lb_bucket_t l1600_eos_o_1_1_1_1 = {
.type = FT_LB_LABEL_O_LB,
@@ -6593,10 +6619,10 @@ fib_test_label (void)
l1600,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &l1600_eos_o_1_1_1_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l1600_eos_o_1_1_1_1),
"2.2.2.2.2/32 LB 1 buckets via: "
"label 1600 over 1.1.1.1");
@@ -6607,18 +6633,18 @@ fib_test_label (void)
urpfi = load_balance_get_urpf(dpo_44.dpoi_index);
FIB_TEST(fib_urpf_check(urpfi, tm->hw[0]->sw_if_index),
- "uRPF check for 2.2.2.2/32 on %d OK",
- tm->hw[0]->sw_if_index);
+ "uRPF check for 2.2.2.2/32 on %d OK",
+ tm->hw[0]->sw_if_index);
FIB_TEST(fib_urpf_check(urpfi, tm->hw[1]->sw_if_index),
- "uRPF check for 2.2.2.2/32 on %d OK",
- tm->hw[1]->sw_if_index);
+ "uRPF check for 2.2.2.2/32 on %d OK",
+ tm->hw[1]->sw_if_index);
FIB_TEST(!fib_urpf_check(urpfi, 99),
- "uRPF check for 2.2.2.2/32 on 99 not-OK",
- 99);
+ "uRPF check for 2.2.2.2/32 on 99 not-OK",
+ 99);
fib_entry_contribute_forwarding(fei, FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS, &dpo_44);
FIB_TEST(urpfi == load_balance_get_urpf(dpo_44.dpoi_index),
- "Shared uRPF on IP and non-EOS chain");
+ "Shared uRPF on IP and non-EOS chain");
dpo_reset(&dpo_44);
@@ -6629,38 +6655,38 @@ fib_test_label (void)
* shut down the link with the valid label
*/
vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[0]->sw_if_index,
- 0);
+ tm->hw[0]->sw_if_index,
+ 0);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &a_o_10_10_11_1,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 2 buckets via: "
- "adj over 10.10.11.1, ",
- "adj-v4 over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &a_o_10_10_11_1,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 2 buckets via: "
+ "adj over 10.10.11.1, ",
+ "adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_2),
- "24001/eos LB 2 buckets via: "
- "mpls-disp adj over 10.10.11.1, ",
- "mpls-disp adj-v4 over 10.10.11.2");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_2),
+ "24001/eos LB 2 buckets via: "
+ "mpls-disp adj over 10.10.11.1, ",
+ "mpls-disp adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &a_mpls_o_10_10_11_1),
- "24001/neos LB 1 buckets via: "
- "adj-mpls over 10.10.11.2");
+ &pfx_24001_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &a_mpls_o_10_10_11_1),
+ "24001/neos LB 1 buckets via: "
+ "adj-mpls over 10.10.11.2");
/*
* test that the pre-failover load-balance has been in-place
@@ -6668,12 +6694,12 @@ fib_test_label (void)
*/
dpo_id_t current = DPO_INVALID;
fib_entry_contribute_forwarding(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &current);
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &current);
FIB_TEST(!dpo_cmp(&non_eos_1_1_1_1,
&current),
- "PIC-core LB inplace modified %U %U",
+ "PIC-core LB inplace modified %U %U",
format_dpo_id, &non_eos_1_1_1_1, 0,
format_dpo_id, &current, 0);
@@ -6684,163 +6710,163 @@ fib_test_label (void)
* no-shut the link with the valid label
*/
vnet_sw_interface_set_flags(vnet_get_main(),
- tm->hw[0]->sw_if_index,
- VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+ tm->hw[0]->sw_if_index,
+ VNET_SW_INTERFACE_FLAG_ADMIN_UP);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 16, // 3 choices spread over 16 buckets
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &a_o_10_10_11_1,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 16 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj over 10.10.11.1",
- "adj-v4 over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 16, // 3 choices spread over 16 buckets
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &a_o_10_10_11_1,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 16 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj over 10.10.11.1",
+ "adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 16, // 3 choices spread over 16 buckets
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &l99_eos_o_10_10_10_1,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_2,
- &disp_o_10_10_11_2,
- &disp_o_10_10_11_2,
- &disp_o_10_10_11_2,
- &disp_o_10_10_11_2),
- "24001/eos LB 16 buckets via: "
- "label 99 over 10.10.10.1, "
- "MPLS disp adj over 10.10.11.1",
- "MPLS disp adj-v4 over 10.10.11.2");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 16, // 3 choices spread over 16 buckets
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &l99_eos_o_10_10_10_1,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_2,
+ &disp_o_10_10_11_2,
+ &disp_o_10_10_11_2,
+ &disp_o_10_10_11_2,
+ &disp_o_10_10_11_2),
+ "24001/eos LB 16 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "MPLS disp adj over 10.10.11.1",
+ "MPLS disp adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 2,
- &l99_neos_o_10_10_10_1,
- &a_mpls_o_10_10_11_1),
- "24001/neos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj-mpls over 10.10.11.2");
+ &pfx_24001_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 2,
+ &l99_neos_o_10_10_10_1,
+ &a_mpls_o_10_10_11_1),
+ "24001/neos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj-mpls over 10.10.11.2");
/*
* remove the first path with the valid label
*/
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &a_o_10_10_11_1,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 2 buckets via: "
- "adj over 10.10.11.1, "
- "adj-v4 over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &a_o_10_10_11_1,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 2 buckets via: "
+ "adj over 10.10.11.1, "
+ "adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &disp_o_10_10_11_1,
- &disp_o_10_10_11_2),
- "24001/eos LB 2 buckets via: "
- "MPLS disp adj over 10.10.11.1, "
- "MPLS disp adj-v4 over 10.10.11.2");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &disp_o_10_10_11_1,
+ &disp_o_10_10_11_2),
+ "24001/eos LB 2 buckets via: "
+ "MPLS disp adj over 10.10.11.1, "
+ "MPLS disp adj-v4 over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
+ &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &a_mpls_o_10_10_11_1),
- "24001/neos LB 1 buckets via: "
- "adj-mpls over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &a_mpls_o_10_10_11_1),
+ "24001/neos LB 1 buckets via: "
+ "adj-mpls over 10.10.11.2");
/*
* remove the other path with a valid label
*/
fib_test_lb_bucket_t bucket_drop = {
- .type = FT_LB_DROP,
+ .type = FT_LB_DROP,
};
fib_test_lb_bucket_t mpls_bucket_drop = {
- .type = FT_LB_DROP,
- .special = {
- .adj = DPO_PROTO_MPLS,
- },
+ .type = FT_LB_DROP,
+ .special = {
+ .adj = DPO_PROTO_MPLS,
+ },
};
fib_table_entry_path_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- DPO_PROTO_IP4,
- &nh_10_10_11_1,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 1 buckets via: "
- "adj over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 1 buckets via: "
+ "adj over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 1,
- &disp_o_10_10_11_2),
- "24001/eos LB 1 buckets via: "
- "MPLS disp adj over 10.10.11.2");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 1,
+ &disp_o_10_10_11_2),
+ "24001/eos LB 1 buckets via: "
+ "MPLS disp adj over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &mpls_bucket_drop),
- "24001/neos LB 1 buckets via: DROP");
+ &pfx_24001_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &mpls_bucket_drop),
+ "24001/neos LB 1 buckets via: DROP");
/*
* add back the path with the valid label
@@ -6849,91 +6875,91 @@ fib_test_label (void)
vec_add1(l99, fml99);
fib_table_entry_path_add(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l99,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l99,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &l99_eos_o_10_10_10_1,
- &adj_o_10_10_11_2),
- "1.1.1.1/32 LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &adj_o_10_10_11_2),
+ "1.1.1.1/32 LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &l99_eos_o_10_10_10_1,
- &disp_o_10_10_11_2),
- "24001/eos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "MPLS disp adj over 10.10.11.2");
+ &pfx_24001_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &disp_o_10_10_11_2),
+ "24001/eos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "MPLS disp adj over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_24001_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &l99_neos_o_10_10_10_1),
- "24001/neos LB 1 buckets via: "
- "label 99 over 10.10.10.1");
+ &pfx_24001_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &l99_neos_o_10_10_10_1),
+ "24001/neos LB 1 buckets via: "
+ "label 99 over 10.10.10.1");
/*
* change the local label
*/
fib_table_entry_local_label_add(fib_index,
- &pfx_1_1_1_1_s_32,
- 25005);
+ &pfx_1_1_1_1_s_32,
+ 25005);
fib_prefix_t pfx_25005_eos = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 25005,
- .fp_eos = MPLS_EOS,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 25005,
+ .fp_eos = MPLS_EOS,
};
fib_prefix_t pfx_25005_neos = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 25005,
- .fp_eos = MPLS_NON_EOS,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 25005,
+ .fp_eos = MPLS_NON_EOS,
};
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup(fib_index, &pfx_24001_eos)),
- "24001/eos removed after label change");
+ fib_table_lookup(fib_index, &pfx_24001_eos)),
+ "24001/eos removed after label change");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- fib_table_lookup(fib_index, &pfx_24001_neos)),
- "24001/eos removed after label change");
+ fib_table_lookup(fib_index, &pfx_24001_neos)),
+ "24001/eos removed after label change");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_25005_eos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &l99_eos_o_10_10_10_1,
- &disp_o_10_10_11_2),
- "25005/eos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "MPLS disp adj over 10.10.11.2");
+ &pfx_25005_eos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &disp_o_10_10_11_2),
+ "25005/eos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "MPLS disp adj over 10.10.11.2");
fei = fib_table_lookup(MPLS_FIB_DEFAULT_TABLE_ID,
- &pfx_25005_neos);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &l99_neos_o_10_10_10_1),
- "25005/neos LB 1 buckets via: "
- "label 99 over 10.10.10.1");
+ &pfx_25005_neos);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &l99_neos_o_10_10_10_1),
+ "25005/neos LB 1 buckets via: "
+ "label 99 over 10.10.10.1");
/*
* remove the local label.
@@ -6941,40 +6967,40 @@ fib_test_label (void)
* MPLS table is no longer present.
*/
fib_table_entry_local_label_remove(fib_index,
- &pfx_1_1_1_1_s_32,
- 25005);
+ &pfx_1_1_1_1_s_32,
+ 25005);
fei = fib_table_lookup(fib_index, &pfx_1_1_1_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &l99_eos_o_10_10_10_1,
- &adj_o_10_10_11_2),
- "24001/eos LB 2 buckets via: "
- "label 99 over 10.10.10.1, "
- "adj over 10.10.11.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &l99_eos_o_10_10_10_1,
+ &adj_o_10_10_11_2),
+ "24001/eos LB 2 buckets via: "
+ "label 99 over 10.10.10.1, "
+ "adj over 10.10.11.2");
FIB_TEST((FIB_NODE_INDEX_INVALID ==
- mpls_fib_index_from_table_id(MPLS_FIB_DEFAULT_TABLE_ID)),
- "No more MPLS FIB entries => table removed");
+ mpls_fib_index_from_table_id(MPLS_FIB_DEFAULT_TABLE_ID)),
+ "No more MPLS FIB entries => table removed");
/*
* add another via-entry for the recursive
*/
fib_prefix_t pfx_1_1_1_2_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x01010102),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x01010102),
+ },
};
fib_test_lb_bucket_t l101_eos_o_10_10_10_1 = {
- .type = FT_LB_LABEL_O_ADJ,
- .label_o_adj = {
- .adj = ai_mpls_10_10_10_1,
- .label = 101,
- .eos = MPLS_EOS,
- },
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_mpls_10_10_10_1,
+ .label = 101,
+ .eos = MPLS_EOS,
+ },
};
fib_mpls_label_t *l101 = NULL, fml101 = {
.fml_value = 101,
@@ -6982,41 +7008,41 @@ fib_test_label (void)
vec_add1(l101, fml101);
fei = fib_table_entry_update_one_path(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l101,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &l101_eos_o_10_10_10_1),
- "1.1.1.2/32 LB 1 buckets via: "
- "label 101 over 10.10.10.1");
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l101,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l101_eos_o_10_10_10_1),
+ "1.1.1.2/32 LB 1 buckets via: "
+ "label 101 over 10.10.10.1");
dpo_id_t non_eos_1_1_1_2 = DPO_INVALID;
fib_entry_contribute_forwarding(fib_table_lookup(fib_index,
- &pfx_1_1_1_1_s_32),
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &non_eos_1_1_1_1);
+ &pfx_1_1_1_1_s_32),
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &non_eos_1_1_1_1);
fib_entry_contribute_forwarding(fib_table_lookup(fib_index,
- &pfx_1_1_1_2_s_32),
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &non_eos_1_1_1_2);
+ &pfx_1_1_1_2_s_32),
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &non_eos_1_1_1_2);
fib_test_lb_bucket_t l1601_eos_o_1_1_1_2 = {
- .type = FT_LB_LABEL_O_LB,
- .label_o_lb = {
- .lb = non_eos_1_1_1_2.dpoi_index,
- .label = 1601,
- .eos = MPLS_EOS,
- },
+ .type = FT_LB_LABEL_O_LB,
+ .label_o_lb = {
+ .lb = non_eos_1_1_1_2.dpoi_index,
+ .label = 1601,
+ .eos = MPLS_EOS,
+ },
};
fib_mpls_label_t *l1601 = NULL, fml1601 = {
.fml_value = 1601,
@@ -7026,25 +7052,25 @@ fib_test_label (void)
l1600_eos_o_1_1_1_1.label_o_lb.lb = non_eos_1_1_1_1.dpoi_index;
fei = fib_table_entry_path_add(fib_index,
- &pfx_2_2_2_2_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_2_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- l1601,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &l1600_eos_o_1_1_1_1,
- &l1601_eos_o_1_1_1_2),
- "2.2.2.2/32 LB 2 buckets via: "
- "label 1600 via 1.1,1.1, "
- "label 16001 via 1.1.1.2");
+ &pfx_2_2_2_2_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_2_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ l1601,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &l1600_eos_o_1_1_1_1,
+ &l1601_eos_o_1_1_1_2),
+ "2.2.2.2/32 LB 2 buckets via: "
+ "label 1600 via 1.1,1.1, "
+ "label 16001 via 1.1.1.2");
/*
* update the via-entry so it no longer has an imp-null path.
@@ -7054,64 +7080,64 @@ fib_test_label (void)
vec_add1(l_imp_null, fml_imp_null);
fei = fib_table_entry_update_one_path(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_11_1,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l_imp_null,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &a_o_10_10_11_1),
- "1.1.1.2/32 LB 1 buckets via: "
- "adj 10.10.11.1");
-
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l_imp_null,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &a_o_10_10_11_1),
+ "1.1.1.2/32 LB 1 buckets via: "
+ "adj 10.10.11.1");
+
fei = fib_table_lookup(fib_index, &pfx_2_2_2_2_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &l1600_eos_o_1_1_1_1,
- &l1601_eos_o_1_1_1_2),
- "2.2.2.2/32 LB 2 buckets via: "
- "label 1600 via 1.1,1.1, "
- "label 16001 via 1.1.1.2");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &l1600_eos_o_1_1_1_1,
+ &l1601_eos_o_1_1_1_2),
+ "2.2.2.2/32 LB 2 buckets via: "
+ "label 1600 via 1.1,1.1, "
+ "label 16001 via 1.1.1.2");
/*
* update the via-entry so it no longer has labelled paths.
* the LB for the recursive should exclue this via form its LB
*/
fei = fib_table_entry_update_one_path(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_11_1,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &a_o_10_10_11_1),
- "1.1.1.2/32 LB 1 buckets via: "
- "adj 10.10.11.1");
-
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &a_o_10_10_11_1),
+ "1.1.1.2/32 LB 1 buckets via: "
+ "adj 10.10.11.1");
+
fei = fib_table_lookup(fib_index, &pfx_2_2_2_2_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &l1600_eos_o_1_1_1_1),
- "2.2.2.2/32 LB 1 buckets via: "
- "label 1600 via 1.1,1.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l1600_eos_o_1_1_1_1),
+ "2.2.2.2/32 LB 1 buckets via: "
+ "label 1600 via 1.1,1.1");
dpo_reset(&non_eos_1_1_1_1);
dpo_reset(&non_eos_1_1_1_2);
@@ -7120,77 +7146,77 @@ fib_test_label (void)
* Add a recursive with no out-labels. We expect to use the IP of the via
*/
fib_prefix_t pfx_2_2_2_3_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020203),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020203),
+ },
};
dpo_id_t ip_1_1_1_1 = DPO_INVALID;
fib_table_entry_update_one_path(fib_index,
- &pfx_2_2_2_3_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2_2_2_3_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_entry_contribute_forwarding(fib_table_lookup(fib_index,
- &pfx_1_1_1_1_s_32),
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- &ip_1_1_1_1);
+ &pfx_1_1_1_1_s_32),
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ &ip_1_1_1_1);
fib_test_lb_bucket_t ip_o_1_1_1_1 = {
- .type = FT_LB_O_LB,
- .lb = {
- .lb = ip_1_1_1_1.dpoi_index,
- },
+ .type = FT_LB_O_LB,
+ .lb = {
+ .lb = ip_1_1_1_1.dpoi_index,
+ },
};
fei = fib_table_lookup(fib_index, &pfx_2_2_2_3_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_1),
- "2.2.2.2.3/32 LB 1 buckets via: "
- "ip 1.1.1.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_1),
+ "2.2.2.2.3/32 LB 1 buckets via: "
+ "ip 1.1.1.1");
/*
- * Add a recursive with an imp-null out-label.
+ * Add a recursive with an imp-null out-label.
* We expect to use the IP of the via
*/
fib_prefix_t pfx_2_2_2_4_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020204),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020204),
+ },
};
fib_table_entry_update_one_path(fib_index,
- &pfx_2_2_2_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &pfx_1_1_1_1_s_32.fp_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx_2_2_2_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &pfx_1_1_1_1_s_32.fp_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup(fib_index, &pfx_2_2_2_4_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1_1_1_1),
- "2.2.2.2.4/32 LB 1 buckets via: "
- "ip 1.1.1.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1_1_1_1),
+ "2.2.2.2.4/32 LB 1 buckets via: "
+ "ip 1.1.1.1");
dpo_reset(&ip_1_1_1_1);
@@ -7198,22 +7224,22 @@ fib_test_label (void)
* Create an entry with a deep label stack
*/
fib_prefix_t pfx_2_2_5_5_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020505),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020505),
+ },
};
fib_test_lb_bucket_t ls_eos_o_10_10_10_1 = {
- .type = FT_LB_LABEL_STACK_O_ADJ,
- .label_stack_o_adj = {
- .adj = ai_mpls_10_10_11_1,
- .label_stack_size = 8,
- .label_stack = {
- 200, 201, 202, 203, 204, 205, 206, 207
- },
- .eos = MPLS_EOS,
- },
+ .type = FT_LB_LABEL_STACK_O_ADJ,
+ .label_stack_o_adj = {
+ .adj = ai_mpls_10_10_11_1,
+ .label_stack_size = 8,
+ .label_stack = {
+ 200, 201, 202, 203, 204, 205, 206, 207
+ },
+ .eos = MPLS_EOS,
+ },
};
fib_mpls_label_t *label_stack = NULL;
vec_validate(label_stack, 7);
@@ -7223,59 +7249,59 @@ fib_test_label (void)
}
fei = fib_table_entry_update_one_path(fib_index,
- &pfx_2_2_5_5_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_11_1,
- tm->hw[1]->sw_if_index,
- ~0, // invalid fib index
- 1,
- label_stack,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ls_eos_o_10_10_10_1),
- "2.2.5.5/32 LB 1 buckets via: "
- "adj 10.10.11.1");
+ &pfx_2_2_5_5_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ label_stack,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ls_eos_o_10_10_10_1),
+ "2.2.5.5/32 LB 1 buckets via: "
+ "adj 10.10.11.1");
fib_table_entry_delete_index(fei, FIB_SOURCE_API);
/*
* cleanup
*/
fib_table_entry_delete(fib_index,
- &pfx_1_1_1_2_s_32,
- FIB_SOURCE_API);
+ &pfx_1_1_1_2_s_32,
+ FIB_SOURCE_API);
fei = fib_table_lookup(fib_index, &pfx_2_2_2_2_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &l1600_eos_o_1_1_1_1),
- "2.2.2.2/32 LB 1 buckets via: "
- "label 1600 via 1.1,1.1");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l1600_eos_o_1_1_1_1),
+ "2.2.2.2/32 LB 1 buckets via: "
+ "label 1600 via 1.1,1.1");
fib_table_entry_delete(fib_index,
- &pfx_1_1_1_1_s_32,
- FIB_SOURCE_API);
+ &pfx_1_1_1_1_s_32,
+ FIB_SOURCE_API);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &bucket_drop),
- "2.2.2.2/32 LB 1 buckets via: DROP");
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "2.2.2.2/32 LB 1 buckets via: DROP");
fib_table_entry_delete(fib_index,
- &pfx_2_2_2_2_s_32,
- FIB_SOURCE_API);
+ &pfx_2_2_2_2_s_32,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_2_2_2_3_s_32,
- FIB_SOURCE_API);
+ &pfx_2_2_2_3_s_32,
+ FIB_SOURCE_API);
fib_table_entry_delete(fib_index,
- &pfx_2_2_2_4_s_32,
- FIB_SOURCE_API);
+ &pfx_2_2_2_4_s_32,
+ FIB_SOURCE_API);
adj_unlock(ai_mpls_10_10_10_1);
adj_unlock(ai_mpls_10_10_11_2);
@@ -7284,33 +7310,33 @@ fib_test_label (void)
adj_unlock(ai_mpls_10_10_11_1);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
local0_pfx.fp_len = 32;
fib_table_entry_delete(fib_index,
- &local0_pfx,
- FIB_SOURCE_INTERFACE);
+ &local0_pfx,
+ FIB_SOURCE_INTERFACE);
local0_pfx.fp_len = 24;
fib_table_entry_delete(fib_index,
- &local0_pfx,
- FIB_SOURCE_INTERFACE);
+ &local0_pfx,
+ FIB_SOURCE_INTERFACE);
local1_pfx.fp_len = 32;
fib_table_entry_delete(fib_index,
- &local1_pfx,
- FIB_SOURCE_INTERFACE);
+ &local1_pfx,
+ FIB_SOURCE_INTERFACE);
local1_pfx.fp_len = 24;
fib_table_entry_delete(fib_index,
- &local1_pfx,
- FIB_SOURCE_INTERFACE);
+ &local1_pfx,
+ FIB_SOURCE_INTERFACE);
/*
* +1 for the drop LB in the MPLS tables.
*/
FIB_TEST(lb_count+1 == pool_elts(load_balance_pool),
- "Load-balance resources freed %d of %d",
+ "Load-balance resources freed %d of %d",
lb_count+1, pool_elts(load_balance_pool));
- return (0);
+ return (res);
}
#define N_TEST_CHILDREN 4
@@ -7329,9 +7355,9 @@ static fib_node_test_t fib_test_nodes[N_TEST_CHILDREN+1];
#define PARENT() (&fib_test_nodes[PARENT_INDEX].node)
-#define FOR_EACH_TEST_CHILD(_tc) \
- for (ii = 1, (_tc) = &fib_test_nodes[1]; \
- ii < N_TEST_CHILDREN+1; \
+#define FOR_EACH_TEST_CHILD(_tc) \
+ for (ii = 1, (_tc) = &fib_test_nodes[1]; \
+ ii < N_TEST_CHILDREN+1; \
ii++, (_tc) = &fib_test_nodes[ii])
static fib_node_t *
@@ -7390,8 +7416,9 @@ fib_test_walk (void)
fib_node_back_walk_ctx_t high_ctx = {}, low_ctx = {};
fib_node_test_t *tc;
vlib_main_t *vm;
- u32 ii;
+ u32 ii, res;
+ res = 0;
vm = vlib_get_main();
fib_node_register_type(FIB_NODE_TYPE_TEST, &fib_test_child_vft);
@@ -7757,7 +7784,7 @@ fib_test_walk (void)
FIB_TEST(1 <= vec_len(tc->ctxs),
"child %d visitsed %d times during looped async spawns async walk",
ii, vec_len(tc->ctxs));
- vec_free(tc->ctxs);
+ vec_free(tc->ctxs);
}
@@ -7784,7 +7811,7 @@ fib_test_walk (void)
FIB_TEST((1 == fib_test_nodes[PARENT_INDEX].destroyed),
"Parent was destroyed");
- return (0);
+ return (res);
}
/*
@@ -7803,8 +7830,9 @@ fib_test_bfd (void)
{
fib_node_index_t fei;
test_main_t *tm;
- int n_feis;
+ int n_feis, res;
+ res = 0;
/* via 10.10.10.1 */
ip46_address_t nh_10_10_10_1 = {
.ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
@@ -7895,10 +7923,10 @@ fib_test_bfd (void)
};
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
"BFD sourced %U via %U",
format_fib_prefix, &pfx_10_10_10_1_s_32,
format_ip_adjacency, ai_10_10_10_1, FORMAT_IP_ADJACENCY_NONE);
@@ -7939,10 +7967,10 @@ fib_test_bfd (void)
fib_bfd_notify (BFD_LISTEN_EVENT_DELETE, &bfd_10_10_10_1);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_1_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
"BFD sourced %U remains via %U",
format_fib_prefix, &pfx_10_10_10_1_s_32,
format_ip_adjacency, ai_10_10_10_1, FORMAT_IP_ADJACENCY_NONE);
@@ -8079,10 +8107,10 @@ fib_test_bfd (void)
NULL,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &lb_o_10_10_10_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &lb_o_10_10_10_1),
"Recursive %U only UP BFD adj-fibs",
format_fib_prefix, &pfx_200_0_0_0_s_24);
@@ -8094,11 +8122,11 @@ fib_test_bfd (void)
fib_bfd_notify (BFD_LISTEN_EVENT_UPDATE, &bfd_10_10_10_2);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &lb_o_10_10_10_1,
- &lb_o_10_10_10_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &lb_o_10_10_10_1,
+ &lb_o_10_10_10_2),
"Recursive %U via both UP BFD adj-fibs",
format_fib_prefix, &pfx_200_0_0_0_s_24);
@@ -8110,10 +8138,10 @@ fib_test_bfd (void)
fib_bfd_notify (BFD_LISTEN_EVENT_UPDATE, &bfd_10_10_10_2);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &lb_o_10_10_10_1),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &lb_o_10_10_10_1),
"Recursive %U via only UP",
format_fib_prefix, &pfx_200_0_0_0_s_24);
@@ -8123,11 +8151,11 @@ fib_test_bfd (void)
*/
fib_bfd_notify (BFD_LISTEN_EVENT_DELETE, &bfd_10_10_10_2);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &lb_o_10_10_10_1,
- &lb_o_10_10_10_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &lb_o_10_10_10_1,
+ &lb_o_10_10_10_2),
"Recursive %U via both UP BFD adj-fibs post down session delete",
format_fib_prefix, &pfx_200_0_0_0_s_24);
@@ -8136,11 +8164,11 @@ fib_test_bfd (void)
*/
fib_bfd_notify (BFD_LISTEN_EVENT_DELETE, &bfd_10_10_10_1);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &lb_o_10_10_10_1,
- &lb_o_10_10_10_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &lb_o_10_10_10_1,
+ &lb_o_10_10_10_2),
"Recursive %U via both UP BFD adj-fibs post up session delete",
format_fib_prefix, &pfx_200_0_0_0_s_24);
@@ -8155,7 +8183,7 @@ fib_test_bfd (void)
fib_table_entry_delete(0, &pfx_10_10_10_10_s_24, FIB_SOURCE_INTERFACE);
adj_unlock(ai_10_10_10_1);
- /*
+ /*
* test no-one left behind
*/
FIB_TEST((n_feis == fib_entry_pool_size()), "Entries gone");
@@ -8249,10 +8277,10 @@ fib_test_bfd (void)
NULL,
FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
"BFD sourced %U via %U",
format_fib_prefix, &pfx_5_5_5_5_s_32,
format_ip_adjacency, ai_10_10_10_2, FORMAT_IP_ADJACENCY_NONE);
@@ -8262,11 +8290,11 @@ fib_test_bfd (void)
*/
bfd_10_10_10_1.local_state = BFD_STATE_up;
adj_bfd_notify(BFD_LISTEN_EVENT_UPDATE, &bfd_10_10_10_1);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 2,
- &adj_o_10_10_10_1,
- &adj_o_10_10_10_2),
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 2,
+ &adj_o_10_10_10_1,
+ &adj_o_10_10_10_2),
"BFD sourced %U via noth adjs",
format_fib_prefix, &pfx_5_5_5_5_s_32);
@@ -8287,29 +8315,30 @@ fib_test_bfd (void)
*/
FIB_TEST((n_feis == fib_entry_pool_size()), "Entries gone");
FIB_TEST(0 == adj_nbr_db_size(), "All adjacencies removed");
- return (0);
+
+ return (res);
}
static int
lfib_test (void)
{
const mpls_label_t deag_label = 50;
+ adj_index_t ai_mpls_10_10_10_1;
dpo_id_t dpo = DPO_INVALID;
- const mpls_disp_dpo_t *mdd;
const u32 lfib_index = 0;
const u32 fib_index = 0;
- const lookup_dpo_t *lkd;
const dpo_id_t *dpo1;
fib_node_index_t lfe;
+ lookup_dpo_t *lkd;
+ int lb_count, res;
test_main_t *tm;
- int lb_count;
- adj_index_t ai_mpls_10_10_10_1;
+ res = 0;
tm = &test_main;
lb_count = pool_elts(load_balance_pool);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
- adj_nbr_db_size());
+ adj_nbr_db_size());
/*
* MPLS enable an interface so we get the MPLS table created
@@ -8320,7 +8349,7 @@ lfib_test (void)
1, 1);
ip46_address_t nh_10_10_10_1 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
};
ai_mpls_10_10_10_1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
VNET_LINK_MPLS,
@@ -8331,24 +8360,24 @@ lfib_test (void)
* Test the specials stack properly.
*/
fib_prefix_t exp_null_v6_pfx = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_eos = MPLS_EOS,
- .fp_label = MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL,
- .fp_payload_proto = DPO_PROTO_IP6,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_eos = MPLS_EOS,
+ .fp_label = MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL,
+ .fp_payload_proto = DPO_PROTO_IP6,
};
lfe = fib_table_lookup(lfib_index, &exp_null_v6_pfx);
FIB_TEST((FIB_NODE_INDEX_INVALID != lfe),
- "%U/%U present",
- format_mpls_unicast_label, MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL,
- format_mpls_eos_bit, MPLS_EOS);
+ "%U/%U present",
+ format_mpls_unicast_label, MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL,
+ format_mpls_eos_bit, MPLS_EOS);
fib_entry_contribute_forwarding(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- &dpo);
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ &dpo);
dpo1 = load_balance_get_bucket(dpo.dpoi_index, 0);
lkd = lookup_dpo_get(dpo1->dpoi_index);
FIB_TEST((fib_index == lkd->lkd_fib_index),
- "%U/%U is deag in %d %U",
+ "%U/%U is deag in %d %U",
format_mpls_unicast_label, deag_label,
format_mpls_eos_bit, MPLS_EOS,
lkd->lkd_fib_index,
@@ -8371,31 +8400,32 @@ lfib_test (void)
* A route deag route for EOS
*/
fib_prefix_t pfx = {
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_eos = MPLS_EOS,
- .fp_label = deag_label,
- .fp_payload_proto = DPO_PROTO_IP4,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_eos = MPLS_EOS,
+ .fp_label = deag_label,
+ .fp_payload_proto = DPO_PROTO_IP4,
};
+ mpls_disp_dpo_t *mdd;
lfe = fib_table_entry_path_add(lfib_index,
- &pfx,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &zero_addr,
- ~0,
- fib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &zero_addr,
+ ~0,
+ fib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST((lfe == fib_table_lookup(lfib_index, &pfx)),
- "%U/%U present",
- format_mpls_unicast_label, deag_label,
- format_mpls_eos_bit, MPLS_EOS);
+ "%U/%U present",
+ format_mpls_unicast_label, deag_label,
+ format_mpls_eos_bit, MPLS_EOS);
fib_entry_contribute_forwarding(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- &dpo);
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ &dpo);
dpo1 = load_balance_get_bucket(dpo.dpoi_index, 0);
mdd = mpls_disp_dpo_get(dpo1->dpoi_index);
@@ -8407,7 +8437,7 @@ lfib_test (void)
lkd = lookup_dpo_get(mdd->mdd_dpo.dpoi_index);
FIB_TEST((fib_index == lkd->lkd_fib_index),
- "%U/%U is deag in %d %U",
+ "%U/%U is deag in %d %U",
format_mpls_unicast_label, deag_label,
format_mpls_eos_bit, MPLS_EOS,
lkd->lkd_fib_index,
@@ -8499,30 +8529,30 @@ lfib_test (void)
*/
pfx.fp_eos = MPLS_NON_EOS;
lfe = fib_table_entry_path_add(lfib_index,
- &pfx,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &zero_addr,
- ~0,
- lfib_index,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ &pfx,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &zero_addr,
+ ~0,
+ lfib_index,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
FIB_TEST((lfe == fib_table_lookup(lfib_index, &pfx)),
- "%U/%U present",
- format_mpls_unicast_label, deag_label,
- format_mpls_eos_bit, MPLS_NON_EOS);
+ "%U/%U present",
+ format_mpls_unicast_label, deag_label,
+ format_mpls_eos_bit, MPLS_NON_EOS);
fib_entry_contribute_forwarding(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &dpo);
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &dpo);
dpo1 = load_balance_get_bucket(dpo.dpoi_index, 0);
lkd = lookup_dpo_get(dpo1->dpoi_index);
FIB_TEST((fib_index == lkd->lkd_fib_index),
- "%U/%U is deag in %d %U",
+ "%U/%U is deag in %d %U",
format_mpls_unicast_label, deag_label,
format_mpls_eos_bit, MPLS_NON_EOS,
lkd->lkd_fib_index,
@@ -8541,10 +8571,10 @@ lfib_test (void)
fib_table_entry_delete_index(lfe, FIB_SOURCE_CLI);
FIB_TEST((FIB_NODE_INDEX_INVALID == fib_table_lookup(lfib_index,
- &pfx)),
- "%U/%U not present",
- format_mpls_unicast_label, deag_label,
- format_mpls_eos_bit, MPLS_EOS);
+ &pfx)),
+ "%U/%U not present",
+ format_mpls_unicast_label, deag_label,
+ format_mpls_eos_bit, MPLS_EOS);
dpo_reset(&dpo);
@@ -8552,21 +8582,21 @@ lfib_test (void)
* An MPLS x-connect
*/
fib_prefix_t pfx_1200 = {
- .fp_len = 21,
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 1200,
- .fp_eos = MPLS_NON_EOS,
+ .fp_len = 21,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 1200,
+ .fp_eos = MPLS_NON_EOS,
};
fib_test_lb_bucket_t neos_o_10_10_10_1 = {
- .type = FT_LB_LABEL_STACK_O_ADJ,
- .label_stack_o_adj = {
- .adj = ai_mpls_10_10_10_1,
- .label_stack_size = 4,
- .label_stack = {
- 200, 300, 400, 500,
- },
- .eos = MPLS_NON_EOS,
- },
+ .type = FT_LB_LABEL_STACK_O_ADJ,
+ .label_stack_o_adj = {
+ .adj = ai_mpls_10_10_10_1,
+ .label_stack_size = 4,
+ .label_stack = {
+ 200, 300, 400, 500,
+ },
+ .eos = MPLS_NON_EOS,
+ },
};
dpo_id_t neos_1200 = DPO_INVALID;
dpo_id_t ip_1200 = DPO_INVALID;
@@ -8581,61 +8611,61 @@ lfib_test (void)
};
lfe = fib_table_entry_update_one_path(fib_index,
- &pfx_1200,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l200,
- FIB_ROUTE_PATH_FLAG_NONE);
-
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &neos_o_10_10_10_1),
- "1200/0 LB 1 buckets via: "
- "adj 10.10.11.1");
+ &pfx_1200,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l200,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &neos_o_10_10_10_1),
+ "1200/0 LB 1 buckets via: "
+ "adj 10.10.11.1");
/*
* A recursive route via the MPLS x-connect
*/
fib_prefix_t pfx_2_2_2_3_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020203),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020203),
+ },
};
fib_route_path_t *rpaths = NULL, rpath = {
.frp_proto = DPO_PROTO_MPLS,
- .frp_local_label = 1200,
+ .frp_local_label = 1200,
.frp_eos = MPLS_NON_EOS,
- .frp_sw_if_index = ~0, // recurive
- .frp_fib_index = 0, // Default MPLS fib
- .frp_weight = 1,
- .frp_flags = FIB_ROUTE_PATH_FLAG_NONE,
- .frp_label_stack = NULL,
+ .frp_sw_if_index = ~0, // recurive
+ .frp_fib_index = 0, // Default MPLS fib
+ .frp_weight = 1,
+ .frp_flags = FIB_ROUTE_PATH_FLAG_NONE,
+ .frp_label_stack = NULL,
};
vec_add1(rpaths, rpath);
fib_table_entry_path_add2(fib_index,
- &pfx_2_2_2_3_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- rpaths);
+ &pfx_2_2_2_3_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ rpaths);
/*
* A labelled recursive route via the MPLS x-connect
*/
fib_prefix_t pfx_2_2_2_4_s_32 = {
- .fp_len = 32,
- .fp_proto = FIB_PROTOCOL_IP4,
- .fp_addr = {
- .ip4.as_u32 = clib_host_to_net_u32(0x02020204),
- },
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x02020204),
+ },
};
fib_mpls_label_t *l999 = NULL, fml_999 = {
.fml_value = 999,
@@ -8643,46 +8673,46 @@ lfib_test (void)
vec_add1(l999, fml_999);
rpaths[0].frp_label_stack = l999,
- fib_table_entry_path_add2(fib_index,
- &pfx_2_2_2_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- rpaths);
+ fib_table_entry_path_add2(fib_index,
+ &pfx_2_2_2_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ rpaths);
fib_entry_contribute_forwarding(fib_table_lookup(fib_index, &pfx_1200),
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- &ip_1200);
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ &ip_1200);
fib_entry_contribute_forwarding(fib_table_lookup(fib_index, &pfx_1200),
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- &neos_1200);
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ &neos_1200);
fib_test_lb_bucket_t ip_o_1200 = {
- .type = FT_LB_O_LB,
- .lb = {
- .lb = ip_1200.dpoi_index,
- },
+ .type = FT_LB_O_LB,
+ .lb = {
+ .lb = ip_1200.dpoi_index,
+ },
};
fib_test_lb_bucket_t mpls_o_1200 = {
- .type = FT_LB_LABEL_O_LB,
- .label_o_lb = {
- .lb = neos_1200.dpoi_index,
- .label = 999,
- .eos = MPLS_EOS,
- },
+ .type = FT_LB_LABEL_O_LB,
+ .label_o_lb = {
+ .lb = neos_1200.dpoi_index,
+ .label = 999,
+ .eos = MPLS_EOS,
+ },
};
lfe = fib_table_lookup(fib_index, &pfx_2_2_2_3_s_32);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &ip_o_1200),
- "2.2.2.2.3/32 LB 1 buckets via: label 1200 EOS");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &ip_o_1200),
+ "2.2.2.2.3/32 LB 1 buckets via: label 1200 EOS");
lfe = fib_table_lookup(fib_index, &pfx_2_2_2_4_s_32);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &mpls_o_1200),
- "2.2.2.2.4/32 LB 1 buckets via: label 1200 non-EOS");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &mpls_o_1200),
+ "2.2.2.2.4/32 LB 1 buckets via: label 1200 non-EOS");
fib_table_entry_delete(fib_index, &pfx_1200, FIB_SOURCE_API);
fib_table_entry_delete(fib_index, &pfx_2_2_2_3_s_32, FIB_SOURCE_API);
@@ -8695,46 +8725,46 @@ lfib_test (void)
* A recursive via a label that does not exist
*/
fib_test_lb_bucket_t bucket_drop = {
- .type = FT_LB_DROP,
- .special = {
- .adj = DPO_PROTO_IP4,
- },
+ .type = FT_LB_DROP,
+ .special = {
+ .adj = DPO_PROTO_IP4,
+ },
};
fib_test_lb_bucket_t mpls_bucket_drop = {
- .type = FT_LB_DROP,
- .special = {
- .adj = DPO_PROTO_MPLS,
- },
+ .type = FT_LB_DROP,
+ .special = {
+ .adj = DPO_PROTO_MPLS,
+ },
};
rpaths[0].frp_label_stack = NULL;
lfe = fib_table_entry_path_add2(fib_index,
- &pfx_2_2_2_4_s_32,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- rpaths);
+ &pfx_2_2_2_4_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ rpaths);
fib_entry_contribute_forwarding(fib_table_lookup(fib_index, &pfx_1200),
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- &ip_1200);
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ &ip_1200);
ip_o_1200.lb.lb = ip_1200.dpoi_index;
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &bucket_drop),
- "2.2.2.2.4/32 LB 1 buckets via: drop");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "2.2.2.2.4/32 LB 1 buckets via: drop");
lfe = fib_table_lookup(fib_index, &pfx_1200);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &bucket_drop),
- "1200/neos LB 1 buckets via: ip4-DROP");
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
- 1,
- &mpls_bucket_drop),
- "1200/neos LB 1 buckets via: mpls-DROP");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "1200/neos LB 1 buckets via: ip4-DROP");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS,
+ 1,
+ &mpls_bucket_drop),
+ "1200/neos LB 1 buckets via: mpls-DROP");
fib_table_entry_delete(fib_index, &pfx_2_2_2_4_s_32, FIB_SOURCE_API);
@@ -8747,15 +8777,15 @@ lfib_test (void)
dpo_id_t idpo = DPO_INVALID;
interface_rx_dpo_add_or_lock(DPO_PROTO_IP4,
- tm->hw[0]->sw_if_index,
- &idpo);
+ tm->hw[0]->sw_if_index,
+ &idpo);
fib_prefix_t pfx_2500 = {
- .fp_len = 21,
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 2500,
- .fp_eos = MPLS_EOS,
- .fp_payload_proto = DPO_PROTO_IP4,
+ .fp_len = 21,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 2500,
+ .fp_eos = MPLS_EOS,
+ .fp_payload_proto = DPO_PROTO_IP4,
};
fib_test_lb_bucket_t rx_intf_0 = {
.type = FT_LB_INTF,
@@ -8765,40 +8795,40 @@ lfib_test (void)
};
lfe = fib_table_entry_update_one_path(fib_index,
- &pfx_2500,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
- NULL,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 0,
- NULL,
- FIB_ROUTE_PATH_INTF_RX);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 1,
- &rx_intf_0),
- "2500 rx-interface 0");
+ &pfx_2500,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 0,
+ NULL,
+ FIB_ROUTE_PATH_INTF_RX);
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 1,
+ &rx_intf_0),
+ "2500 rx-interface 0");
fib_table_entry_delete(fib_index, &pfx_2500, FIB_SOURCE_API);
/*
* An MPLS mulicast entry
*/
fib_prefix_t pfx_3500 = {
- .fp_len = 21,
- .fp_proto = FIB_PROTOCOL_MPLS,
- .fp_label = 3500,
- .fp_eos = MPLS_EOS,
- .fp_payload_proto = DPO_PROTO_IP4,
+ .fp_len = 21,
+ .fp_proto = FIB_PROTOCOL_MPLS,
+ .fp_label = 3500,
+ .fp_eos = MPLS_EOS,
+ .fp_payload_proto = DPO_PROTO_IP4,
};
fib_test_rep_bucket_t mc_0 = {
.type = FT_REP_LABEL_O_ADJ,
- .label_o_adj = {
- .adj = ai_mpls_10_10_10_1,
- .label = 3300,
- .eos = MPLS_EOS,
- },
+ .label_o_adj = {
+ .adj = ai_mpls_10_10_10_1,
+ .label = 3300,
+ .eos = MPLS_EOS,
+ },
};
fib_test_rep_bucket_t mc_intf_0 = {
.type = FT_REP_INTF,
@@ -8812,42 +8842,42 @@ lfib_test (void)
vec_add1(l3300, fml_3300);
lfe = fib_table_entry_update_one_path(lfib_index,
- &pfx_3500,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_MULTICAST,
- DPO_PROTO_IP4,
- &nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0, // invalid fib index
- 1,
- l3300,
- FIB_ROUTE_PATH_FLAG_NONE);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 1,
- &mc_0),
- "3500 via replicate over 10.10.10.1");
+ &pfx_3500,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_MULTICAST,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_1,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l3300,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 1,
+ &mc_0),
+ "3500 via replicate over 10.10.10.1");
/*
* MPLS Bud-node. Add a replication via an interface-receieve path
*/
lfe = fib_table_entry_path_add(lfib_index,
- &pfx_3500,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_MULTICAST,
- DPO_PROTO_IP4,
+ &pfx_3500,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_MULTICAST,
+ DPO_PROTO_IP4,
NULL,
tm->hw[0]->sw_if_index,
~0, // invalid fib index
0,
NULL,
FIB_ROUTE_PATH_INTF_RX);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 2,
- &mc_0,
- &mc_intf_0),
- "3500 via replicate over 10.10.10.1 and interface-rx");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 2,
+ &mc_0,
+ &mc_intf_0),
+ "3500 via replicate over 10.10.10.1 and interface-rx");
/*
* Add a replication via an interface-free for-us path
@@ -8859,26 +8889,26 @@ lfib_test (void)
},
};
lfe = fib_table_entry_path_add(lfib_index,
- &pfx_3500,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_MULTICAST,
- DPO_PROTO_IP4,
+ &pfx_3500,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_MULTICAST,
+ DPO_PROTO_IP4,
NULL,
5, // rpf-id
0, // default table
0,
NULL,
FIB_ROUTE_PATH_RPF_ID);
- FIB_TEST(fib_test_validate_entry(lfe,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 3,
- &mc_0,
- &mc_disp,
- &mc_intf_0),
- "3500 via replicate over 10.10.10.1 and interface-rx");
+ FIB_TEST(!fib_test_validate_entry(lfe,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 3,
+ &mc_0,
+ &mc_disp,
+ &mc_intf_0),
+ "3500 via replicate over 10.10.10.1 and interface-rx");
+
-
fib_table_entry_delete(fib_index, &pfx_3500, FIB_SOURCE_API);
dpo_reset(&idpo);
@@ -8894,13 +8924,13 @@ lfib_test (void)
"mpls_disp_dpo resources freed %d of %d",
0, pool_elts(mpls_disp_dpo_pool));
FIB_TEST(lb_count == pool_elts(load_balance_pool),
- "Load-balance resources freed %d of %d",
+ "Load-balance resources freed %d of %d",
lb_count, pool_elts(load_balance_pool));
FIB_TEST(0 == pool_elts(interface_rx_dpo_pool),
- "interface_rx_dpo resources freed %d of %d",
+ "interface_rx_dpo resources freed %d of %d",
0, pool_elts(interface_rx_dpo_pool));
- return (0);
+ return (res);
}
static int
@@ -8908,37 +8938,47 @@ fib_test_inherit (void)
{
fib_node_index_t fei;
test_main_t *tm;
- int n_feis;
+ int n_feis, res;
+ res = 0;
n_feis = fib_entry_pool_size();
tm = &test_main;
const ip46_address_t nh_10_10_10_1 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
};
const ip46_address_t nh_10_10_10_2 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a02),
+ };
+ const ip46_address_t nh_10_10_10_3 = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a03),
};
const ip46_address_t nh_10_10_10_16 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a10),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a10),
};
const ip46_address_t nh_10_10_10_20 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a14),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a14),
};
const ip46_address_t nh_10_10_10_21 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a15),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a15),
};
const ip46_address_t nh_10_10_10_22 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a16),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a16),
};
const ip46_address_t nh_10_10_10_255 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0aff),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0aff),
};
const ip46_address_t nh_10_10_10_0 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a00),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a00),
};
const ip46_address_t nh_10_10_0_0 = {
- .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0000),
+ .ip4.as_u32 = clib_host_to_net_u32(0x0a0a0000),
+ };
+ const ip46_address_t nh_11_11_11_11 = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x0b0b0b0b),
+ };
+ const ip46_address_t nh_11_11_11_0 = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x0b0b0b00),
};
/*
@@ -8959,19 +8999,20 @@ fib_test_inherit (void)
.fp_proto = FIB_PROTOCOL_IP4,
.fp_addr = nh_10_10_10_255,
};
+ const u32 N_PLS = fib_path_list_pool_size();
fib_table_entry_special_add(0,
- &pfx_10_10_10_21_s_32,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_10_10_10_21_s_32,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
fib_table_entry_special_add(0,
- &pfx_10_10_10_22_s_32,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_10_10_10_22_s_32,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
fib_table_entry_special_add(0,
- &pfx_10_10_10_255_s_32,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_10_10_10_255_s_32,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
/*
* source an entry that pushes its state down the sub-tree
@@ -8983,15 +9024,15 @@ fib_test_inherit (void)
};
fib_table_entry_update_one_path(0,
&pfx_10_10_10_16_s_28,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* this covering entry and all those below it should have
@@ -9002,32 +9043,32 @@ fib_test_inherit (void)
&nh_10_10_10_1,
tm->hw[0]->sw_if_index);
fib_test_lb_bucket_t adj_o_10_10_10_1 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_10_10_10_1,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_10_10_10_1,
+ },
};
fei = fib_table_lookup(0, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_16_s_28);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
@@ -9054,46 +9095,46 @@ fib_test_inherit (void)
};
fib_table_entry_update_one_path(0,
&pfx_10_10_10_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/*
* whole sub-tree now covered
*/
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_0_s_24);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_255_s_32);
/*
@@ -9101,15 +9142,15 @@ fib_test_inherit (void)
* this one is directly covered by the root
*/
fib_table_entry_special_add(0,
- &pfx_10_10_10_16_s_28,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_10_10_10_16_s_28,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_16_s_28);
/*
@@ -9122,15 +9163,15 @@ fib_test_inherit (void)
.fp_addr = nh_10_10_10_20,
};
fib_table_entry_special_add(0,
- &pfx_10_10_10_20_s_30,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_10_10_10_20_s_30,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_20_s_30);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_20_s_30);
/*
@@ -9155,50 +9196,50 @@ fib_test_inherit (void)
&nh_10_10_10_2,
tm->hw[0]->sw_if_index);
fib_test_lb_bucket_t adj_o_10_10_10_2 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_10_10_10_2,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_10_10_10_2,
+ },
};
fib_table_entry_update_one_path(0,
&pfx_10_10_10_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_0_s_24);
/*
@@ -9207,21 +9248,21 @@ fib_test_inherit (void)
*/
fib_table_entry_update_one_path(0,
&pfx_10_10_10_0_s_24,
- FIB_SOURCE_PLUGIN_HI,
- FIB_ENTRY_FLAG_NONE,
- DPO_PROTO_IP4,
+ FIB_SOURCE_PLUGIN_HI,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_0_s_24);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
@@ -9236,7 +9277,7 @@ fib_test_inherit (void)
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
"%U resolves via drop",
format_fib_prefix, &pfx_10_10_10_255_s_32);
- fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_16_s_28);
+ fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_16_s_28);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
"%U resolves via drop",
format_fib_prefix, &pfx_10_10_10_16_s_28);
@@ -9248,39 +9289,39 @@ fib_test_inherit (void)
fib_table_entry_delete(0, &pfx_10_10_10_0_s_24, FIB_SOURCE_PLUGIN_HI);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_0_s_24);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_16_s_28);
/*
@@ -9289,51 +9330,51 @@ fib_test_inherit (void)
*/
fib_table_entry_update_one_path(0,
&pfx_10_10_10_16_s_28,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_16_s_28);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_21_s_32);
/* these two unaffected by the sub-tree change */
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_0_s_24);
/*
@@ -9342,86 +9383,86 @@ fib_test_inherit (void)
fib_table_entry_delete(0, &pfx_10_10_10_16_s_28, FIB_SOURCE_API);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_0_s_24);
/*
* modify the /24. expect the new forwarding to be pushed down
*/
fib_table_entry_update_one_path(0,
&pfx_10_10_10_0_s_24,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_0_s_24);
/*
@@ -9434,72 +9475,462 @@ fib_test_inherit (void)
};
fib_table_entry_update_one_path(0,
&pfx_10_10_0_0_s_16,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP4,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
&nh_10_10_10_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_16_s_28);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
- format_fib_prefix, &pfx_10_10_10_21_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_22_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_22_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_255_s_32);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_255_s_32);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_1),
- "%U via 10.10.10.1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_1),
+ "%U via 10.10.10.1",
format_fib_prefix, &pfx_10_10_10_0_s_24);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_0_0_s_16);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
- 1,
- &adj_o_10_10_10_2),
- "%U via 10.10.10.2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_2),
+ "%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_0_0_s_16);
/*
- * cleanup
+ * Add/remove an interposer source to a new /32
+ */
+ const fib_prefix_t pfx_11_11_11_11_s_32 = {
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = nh_11_11_11_11,
+ };
+
+ fib_table_entry_update_one_path(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ dpo_id_t interposer = DPO_INVALID;
+ fib_mpls_label_t *l99 = NULL, fml_99 = {
+ .fml_value = 99,
+ };
+ vec_add1(l99, fml_99);
+
+ mpls_label_dpo_create(l99,
+ MPLS_EOS,
+ DPO_PROTO_IP4,
+ MPLS_LABEL_DPO_FLAG_NONE,
+ punt_dpo_get(DPO_PROTO_MPLS),
+ &interposer);
+
+ adj_index_t ai_10_10_10_3 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
+ VNET_LINK_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index);
+ fib_test_lb_bucket_t adj_o_10_10_10_3 = {
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_10_10_10_3,
+ },
+ };
+ fib_test_lb_bucket_t l99_o_10_10_10_3 = {
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_10_10_10_3,
+ .label = 99,
+ .eos = MPLS_EOS,
+ },
+ };
+
+ fei = fib_table_entry_special_dpo_add(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_INTERPOSE,
+ &interposer);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer adj",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ fib_table_entry_special_remove(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_SPECIAL);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_3),
+ "%U via 10.10.10.1",
+ format_fib_prefix, &pfx_11_11_11_11_s_32);
+
+ /*
+ * remove and re-add the second best API source while the interpose
+ * is present
+ */
+ fei = fib_table_entry_special_dpo_add(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_INTERPOSE,
+ &interposer);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer adj",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ FIB_TEST(2 == pool_elts(mpls_label_dpo_pool),
+ "MPLS label pool: %d",
+ pool_elts(mpls_label_dpo_pool));
+
+ fib_table_entry_delete(0, &pfx_11_11_11_11_s_32, FIB_SOURCE_API);
+
+ /*
+ * the interpose does not get stacked when there are not valid paths
+ */
+ fib_test_lb_bucket_t bucket_drop = {
+ .type = FT_LB_DROP,
+ .special = {
+ .adj = DPO_PROTO_IP4,
+ },
+ };
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "%U via drop",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ fib_table_entry_update_one_path(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer adj",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+ fib_table_entry_delete(0, &pfx_11_11_11_11_s_32, FIB_SOURCE_API);
+
+ /*
+ * add a cover for the interposed entry, so that we test it selects
+ * the covers forwarding.
+ */
+ const fib_prefix_t pfx_11_11_11_0_s_24 = {
+ .fp_len = 24,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = nh_11_11_11_0,
+ };
+ fib_table_entry_update_one_path(0,
+ &pfx_11_11_11_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer adj",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ /*
+ * multiple interpose sources on the same entry. Only the high
+ * priority source gets to add the interpose.
+ */
+ dpo_id_t interposer2 = DPO_INVALID;
+ fib_mpls_label_t *l100 = NULL, fml_100 = {
+ .fml_value = 100,
+ };
+ vec_add1(l100, fml_100);
+
+ mpls_label_dpo_create(l100,
+ MPLS_EOS,
+ DPO_PROTO_IP4,
+ MPLS_LABEL_DPO_FLAG_NONE,
+ punt_dpo_get(DPO_PROTO_MPLS),
+ &interposer2);
+
+ fei = fib_table_entry_special_dpo_add(0,
+ &pfx_11_11_11_11_s_32,
+ FIB_SOURCE_CLASSIFY,
+ FIB_ENTRY_FLAG_INTERPOSE,
+ &interposer2);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer label 99",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ fib_test_lb_bucket_t l100_o_10_10_10_3 = {
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_10_10_10_3,
+ .label = 100,
+ .eos = MPLS_EOS,
+ },
+ };
+
+ fib_table_entry_delete(0, &pfx_11_11_11_11_s_32, FIB_SOURCE_SPECIAL);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l100_o_10_10_10_3),
+ "%U via interposer label 99",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+
+ fib_table_entry_delete(0, &pfx_11_11_11_0_s_24, FIB_SOURCE_API);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "%U via drop",
+ format_fib_prefix,&pfx_11_11_11_11_s_32);
+ fib_table_entry_delete(0, &pfx_11_11_11_11_s_32, FIB_SOURCE_CLASSIFY);
+
+ /*
+ * update a source to/from interpose.
+ */
+ /* fib_table_entry_update_one_path(0, */
+ /* &pfx_11_11_11_0_s_24, */
+ /* FIB_SOURCE_API, */
+ /* FIB_ENTRY_FLAG_NONE, */
+ /* DPO_PROTO_IP4, */
+ /* &nh_10_10_10_3, */
+ /* tm->hw[0]->sw_if_index, */
+ /* ~0, */
+ /* 1, */
+ /* NULL, */
+ /* FIB_ROUTE_PATH_FLAG_NONE); */
+ /* fei = fib_table_entry_special_dpo_add(0, */
+ /* &pfx_11_11_11_11_s_32, */
+ /* FIB_SOURCE_API, */
+ /* FIB_ENTRY_FLAG_INTERPOSE, */
+ /* &interposer); */
+ /* FIB_TEST(!fib_test_validate_entry(fei, */
+ /* FIB_FORW_CHAIN_TYPE_UNICAST_IP4, */
+ /* 1, */
+ /* &l99_o_10_10_10_3), */
+ /* "%U via interposer label 99", */
+ /* format_fib_prefix,&pfx_11_11_11_11_s_32); */
+
+ /* FIB_TEST(3 == pool_elts(mpls_label_dpo_pool), */
+ /* "MPLS label pool: %d", */
+ /* pool_elts(mpls_label_dpo_pool)); */
+ /* FIB_TEST((2 == mpls_label_dpo_get(interposer.dpoi_index)->mld_locks), */
+ /* "Interposer %d locks", */
+ /* mpls_label_dpo_get(interposer.dpoi_index)->mld_locks); */
+
+ /* fib_table_entry_update_one_path(0, */
+ /* &pfx_11_11_11_11_s_32, */
+ /* FIB_SOURCE_API, */
+ /* FIB_ENTRY_FLAG_NONE, */
+ /* DPO_PROTO_IP4, */
+ /* &nh_10_10_10_2, */
+ /* tm->hw[0]->sw_if_index, */
+ /* ~0, */
+ /* 1, */
+ /* NULL, */
+ /* FIB_ROUTE_PATH_FLAG_NONE); */
+ /* FIB_TEST(!fib_test_validate_entry(fei, */
+ /* FIB_FORW_CHAIN_TYPE_UNICAST_IP4, */
+ /* 1, */
+ /* &adj_o_10_10_10_2), */
+ /* "%U via 10.10.10.2", */
+ /* format_fib_prefix,&pfx_11_11_11_11_s_32); */
+
+ /* FIB_TEST((1 == mpls_label_dpo_get(interposer.dpoi_index)->mld_locks), */
+ /* "Interposer %d locks", */
+ /* mpls_label_dpo_get(interposer.dpoi_index)->mld_locks); */
+ /* FIB_TEST(2 == pool_elts(mpls_label_dpo_pool), */
+ /* "MPLS label pool: %d", */
+ /* pool_elts(mpls_label_dpo_pool)); */
+
+ /* fei = fib_table_entry_special_dpo_add(0, */
+ /* &pfx_11_11_11_11_s_32, */
+ /* FIB_SOURCE_API, */
+ /* FIB_ENTRY_FLAG_INTERPOSE, */
+ /* &interposer); */
+ /* FIB_TEST(!fib_test_validate_entry(fei, */
+ /* FIB_FORW_CHAIN_TYPE_UNICAST_IP4, */
+ /* 1, */
+ /* &l99_o_10_10_10_3), */
+ /* "%U via interposer label 99", */
+ /* format_fib_prefix,&pfx_11_11_11_11_s_32); */
+
+ /* fib_table_entry_delete(0, &pfx_11_11_11_11_s_32, FIB_SOURCE_API); */
+
+ /*
+ * Add/remove an interposer source from the top of the subtrie. The
+ * interposer source is not inherited.
+ */
+ fib_table_entry_update_one_path(0,
+ &pfx_10_10_10_0_s_24,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ fei = fib_table_entry_special_dpo_add(0,
+ &pfx_10_10_10_0_s_24,
+ FIB_SOURCE_SPECIAL,
+ FIB_ENTRY_FLAG_INTERPOSE,
+ &interposer);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer label",
+ format_fib_prefix,&pfx_10_10_10_0_s_24);
+ fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "%U via drop",
+ format_fib_prefix, &pfx_10_10_10_21_s_32);
+
+ fib_table_entry_special_remove(0,
+ &pfx_10_10_10_0_s_24,
+ FIB_SOURCE_SPECIAL);
+ fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_0_s_24);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_3),
+ "%U via 10.10.10.1",
+ format_fib_prefix, &pfx_10_10_10_0_s_24);
+ fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &adj_o_10_10_10_3),
+ "%U via via 10.10.10.1",
+ format_fib_prefix, &pfx_10_10_10_21_s_32);
+
+ /*
+ * Add/remove an interposer source from the top of the subtrie. The
+ * interposer source is inherited.
*/
+ fei = fib_table_entry_special_dpo_add(0,
+ &pfx_10_10_10_0_s_24,
+ FIB_SOURCE_SPECIAL,
+ (FIB_ENTRY_FLAG_COVERED_INHERIT |
+ FIB_ENTRY_FLAG_INTERPOSE),
+ &interposer);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer label",
+ format_fib_prefix,&pfx_10_10_10_0_s_24);
+
+ /* interposer gets forwarding from the drop cli source */
+ fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &bucket_drop),
+ "%U via drop",
+ format_fib_prefix,&pfx_10_10_10_21_s_32);
+
+ fib_table_entry_update_one_path(0,
+ &pfx_10_10_10_21_s_32,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_10_3,
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fib_table_entry_delete(0, &pfx_10_10_10_21_s_32, FIB_SOURCE_CLI);
+ /* interposer gets forwarding from the API source */
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l99_o_10_10_10_3),
+ "%U via interposer label",
+ format_fib_prefix,&pfx_10_10_10_21_s_32);
+
+ /*
+ * cleanup
+ */
fib_table_entry_delete(0, &pfx_10_10_10_22_s_32, FIB_SOURCE_CLI);
+ fib_table_entry_delete(0, &pfx_10_10_10_21_s_32, FIB_SOURCE_API);
fib_table_entry_delete(0, &pfx_10_10_10_16_s_28, FIB_SOURCE_CLI);
fib_table_entry_delete(0, &pfx_10_10_10_255_s_32, FIB_SOURCE_CLI);
fib_table_entry_delete(0, &pfx_10_10_10_0_s_24, FIB_SOURCE_API);
fib_table_entry_delete(0, &pfx_10_10_0_0_s_16, FIB_SOURCE_API);
+ fib_table_entry_delete(0, &pfx_10_10_10_0_s_24, FIB_SOURCE_SPECIAL);
adj_unlock(ai_10_10_10_1);
adj_unlock(ai_10_10_10_2);
+ adj_unlock(ai_10_10_10_3);
+ dpo_reset(&interposer);
+ dpo_reset(&interposer2);
+ FIB_TEST(0 == pool_elts(mpls_label_dpo_pool),
+ "MPLS label pool empty: %d",
+ pool_elts(mpls_label_dpo_pool));
+ FIB_TEST(0 == adj_nbr_db_size(), "All adjacencies removed");
+ FIB_TEST(N_PLS == fib_path_list_pool_size(),
+ "number of path-lists: %d = %d",
+ N_PLS, fib_path_list_pool_size());
/*
* test the v6 tree walk.
- * a /64 that covers everytinhg. a /96 that covers one /128
+ * a /64 that covers everything. a /96 that covers one /128
* a second /128 covered only by the /64.
*/
const fib_prefix_t pfx_2001_s_64 = {
@@ -9507,10 +9938,10 @@ fib_test_inherit (void)
.fp_proto = FIB_PROTOCOL_IP6,
.fp_addr = {
.ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000000),
- [1] = clib_host_to_net_u64(0x0000000000000000),
- },
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000000),
+ [1] = clib_host_to_net_u64(0x0000000000000000),
+ },
},
},
};
@@ -9519,10 +9950,10 @@ fib_test_inherit (void)
.fp_proto = FIB_PROTOCOL_IP6,
.fp_addr = {
.ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000000),
- [1] = clib_host_to_net_u64(0x1000000000000000),
- },
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000000),
+ [1] = clib_host_to_net_u64(0x1000000000000000),
+ },
},
},
};
@@ -9531,10 +9962,10 @@ fib_test_inherit (void)
.fp_proto = FIB_PROTOCOL_IP6,
.fp_addr = {
.ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000000),
- [1] = clib_host_to_net_u64(0x1000000000000001),
- },
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000000),
+ [1] = clib_host_to_net_u64(0x1000000000000001),
+ },
},
},
};
@@ -9543,10 +9974,10 @@ fib_test_inherit (void)
.fp_proto = FIB_PROTOCOL_IP6,
.fp_addr = {
.ip6 = {
- .as_u64 = {
- [0] = clib_host_to_net_u64(0x2001000000000000),
- [1] = clib_host_to_net_u64(0x0000000000000001),
- },
+ .as_u64 = {
+ [0] = clib_host_to_net_u64(0x2001000000000000),
+ [1] = clib_host_to_net_u64(0x0000000000000001),
+ },
},
},
};
@@ -9575,54 +10006,54 @@ fib_test_inherit (void)
&nh_3000_2,
tm->hw[0]->sw_if_index);
fib_test_lb_bucket_t adj_o_3000_1 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_3000_1,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_3000_1,
+ },
};
fib_test_lb_bucket_t adj_o_3000_2 = {
- .type = FT_LB_ADJ,
- .adj = {
- .adj = ai_3000_2,
- },
+ .type = FT_LB_ADJ,
+ .adj = {
+ .adj = ai_3000_2,
+ },
};
fib_table_entry_special_add(0,
- &pfx_2001_0_1_s_128,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_2001_0_1_s_128,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
fib_table_entry_special_add(0,
- &pfx_2001_1_1_s_128,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_DROP);
+ &pfx_2001_1_1_s_128,
+ FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_DROP);
/*
* /96 has inherited forwarding pushed down to its covered /128
*/
fib_table_entry_update_one_path(0,
&pfx_2001_1_s_96,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP6,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP6,
&nh_3000_1,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_2001_1_s_96);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_1),
- "%U via 3000::1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_1),
+ "%U via 3000::1",
format_fib_prefix, &pfx_2001_1_s_96);
fei = fib_table_lookup_exact_match(0, &pfx_2001_1_1_s_128);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_1),
- "%U via 3000::1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_1),
+ "%U via 3000::1",
format_fib_prefix, &pfx_2001_1_1_s_128);
fei = fib_table_lookup_exact_match(0, &pfx_2001_0_1_s_128);
FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)),
@@ -9635,44 +10066,44 @@ fib_test_inherit (void)
*/
fib_table_entry_update_one_path(0,
&pfx_2001_s_64,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_COVERED_INHERIT,
- DPO_PROTO_IP6,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_COVERED_INHERIT,
+ DPO_PROTO_IP6,
&nh_3000_2,
- tm->hw[0]->sw_if_index,
- ~0,
- 1,
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
+ tm->hw[0]->sw_if_index,
+ ~0,
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
fei = fib_table_lookup_exact_match(0, &pfx_2001_s_64);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_2),
- "%U via 3000::2",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_2),
+ "%U via 3000::2",
format_fib_prefix, &pfx_2001_s_64);
fei = fib_table_lookup_exact_match(0, &pfx_2001_0_1_s_128);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_2),
- "%U via 3000::1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_2),
+ "%U via 3000::1",
format_fib_prefix, &pfx_2001_0_1_s_128);
fei = fib_table_lookup_exact_match(0, &pfx_2001_1_s_96);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_1),
- "%U via 3000::1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_1),
+ "%U via 3000::1",
format_fib_prefix, &pfx_2001_1_s_96);
fei = fib_table_lookup_exact_match(0, &pfx_2001_1_1_s_128);
- FIB_TEST(fib_test_validate_entry(fei,
- FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
- 1,
- &adj_o_3000_1),
- "%U via 3000::1",
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6,
+ 1,
+ &adj_o_3000_1),
+ "%U via 3000::1",
format_fib_prefix, &pfx_2001_1_1_s_128);
/*
@@ -9690,17 +10121,19 @@ fib_test_inherit (void)
*/
FIB_TEST((n_feis == fib_entry_pool_size()), "Entries gone");
FIB_TEST(0 == adj_nbr_db_size(), "All adjacencies removed");
- return (0);
+
+ return (res);
}
static clib_error_t *
-fib_test (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd_arg)
+fib_test (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd_arg)
{
int res;
res = 0;
+
fib_test_mk_intf(4);
if (unformat (input, "debug"))
@@ -9708,49 +10141,57 @@ fib_test (vlib_main_t * vm,
fib_test_do_debug = 1;
}
- if (unformat (input, "ip"))
+ if (unformat (input, "ip4"))
{
- res += fib_test_v4();
- res += fib_test_v6();
+ res += fib_test_v4();
+ }
+ else if (unformat (input, "ip6"))
+ {
+ res += fib_test_v6();
+ }
+ else if (unformat (input, "ip"))
+ {
+ res += fib_test_v4();
+ res += fib_test_v6();
}
else if (unformat (input, "label"))
{
- res += fib_test_label();
+ res += fib_test_label();
}
else if (unformat (input, "ae"))
{
- res += fib_test_ae();
+ res += fib_test_ae();
}
else if (unformat (input, "pref"))
{
- res += fib_test_pref();
+ res += fib_test_pref();
}
else if (unformat (input, "lfib"))
{
- res += lfib_test();
+ res += lfib_test();
}
else if (unformat (input, "walk"))
{
- res += fib_test_walk();
+ res += fib_test_walk();
}
else if (unformat (input, "bfd"))
{
- res += fib_test_bfd();
+ res += fib_test_bfd();
}
else if (unformat (input, "inherit"))
{
- res += fib_test_inherit();
+ res += fib_test_inherit();
}
else
{
- res += fib_test_v4();
- res += fib_test_v6();
- res += fib_test_ae();
- res += fib_test_bfd();
- res += fib_test_pref();
- res += fib_test_label();
+ res += fib_test_v4();
+ res += fib_test_v6();
+ res += fib_test_ae();
+ res += fib_test_bfd();
+ res += fib_test_pref();
+ res += fib_test_label();
res += fib_test_inherit();
- res += lfib_test();
+ res += lfib_test();
/*
* fib-walk process must be disabled in order for the walk tests to work
@@ -9760,6 +10201,7 @@ fib_test (vlib_main_t * vm,
fib_walk_process_enable();
}
+ fflush(NULL);
if (res)
{
return clib_error_return(0, "FIB Unit Test Failed");
diff --git a/src/vnet/fib/fib_test.h b/src/vnet/fib/fib_test.h
index 8ac068350c4..b2abcf537fa 100644
--- a/src/vnet/fib/fib_test.h
+++ b/src/vnet/fib/fib_test.h
@@ -35,6 +35,7 @@ typedef enum fib_test_lb_bucket_type_t_ {
FT_LB_BIER_TABLE,
FT_LB_BIER_FMASK,
FT_LB_DROP,
+ FT_LB_PUNT,
FT_LB_ADJ,
} fib_test_lb_bucket_type_t;
diff --git a/src/vnet/fib/fib_types.api b/src/vnet/fib/fib_types.api
index 89f87c0f16f..d946ed7889d 100644
--- a/src/vnet/fib/fib_types.api
+++ b/src/vnet/fib/fib_types.api
@@ -37,7 +37,8 @@ typeonly define fib_mpls_label
@param is_source_lookup - The the path is a deaggregate path (i.e. a lookup
in another table) is the lookup on the packet's
source address or destination.
- @param afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
+ @param afi - dpo_proto_t protocol that describes the next-hop address
+ @param via_label - The next-hop is a resolved via a local label
@param next_hop[16] - the next hop address
@param next_hop_id - Used when the path resolves via an object
that has a unique identifier. e.g. the UDP
diff --git a/src/vnet/mfib/mfib_test.c b/src/vnet/mfib/mfib_test.c
index f60d428cfcf..8c75e349b86 100644
--- a/src/vnet/mfib/mfib_test.c
+++ b/src/vnet/mfib/mfib_test.c
@@ -33,23 +33,24 @@
if (!(_evald)) { \
fformat(stderr, "FAIL:%d: " _comment "\n", \
__LINE__, ##_args); \
+ res = 1; \
} else { \
fformat(stderr, "PASS:%d: " _comment "\n", \
__LINE__, ##_args); \
} \
- _evald; \
+ res; \
})
#define MFIB_TEST(_cond, _comment, _args...) \
{ \
- if (!MFIB_TEST_I(_cond, _comment, ##_args)) { \
- return 1;\
+ if (MFIB_TEST_I(_cond, _comment, ##_args)) { \
+ return 1; \
ASSERT(!("FAIL: " _comment)); \
} \
}
#define MFIB_TEST_NS(_cond) \
{ \
- if (!MFIB_TEST_I(_cond, "")) { \
- return 1;\
+ if (MFIB_TEST_I(_cond, "")) { \
+ return 1; \
ASSERT(!("FAIL: ")); \
} \
}
@@ -111,8 +112,10 @@ mfib_test_mk_intf (u32 ninterfaces)
clib_error_t * error = NULL;
test_main_t *tm = &test_main;
u8 byte;
+ int res;
u32 i;
+ res = 0;
ASSERT(ninterfaces <= ARRAY_LEN(tm->hw_if_indicies));
for (i=0; i<6; i++)
@@ -167,13 +170,13 @@ mfib_test_mk_intf (u32 ninterfaces)
tm->hw_if_indicies[i]);
}
- return (0);
+ return (res);
}
#define MFIB_TEST_REP(_cond, _comment, _args...) \
{ \
- if (!MFIB_TEST_I(_cond, _comment, ##_args)) { \
- return (0); \
+ if (MFIB_TEST_I(_cond, _comment, ##_args)) { \
+ return (1); \
} \
}
@@ -186,7 +189,9 @@ mfib_test_validate_rep_v (const replicate_t *rep,
adj_index_t ai;
dpo_type_t dt;
int bucket;
+ int res;
+ res = 0;
MFIB_TEST_REP((n_buckets == rep->rep_n_buckets),
"n_buckets = %d", rep->rep_n_buckets);
@@ -209,7 +214,7 @@ mfib_test_validate_rep_v (const replicate_t *rep,
format_dpo_id, dpo, 0);
}
}
- return (!0);
+ return (res);
}
static fib_forward_chain_type_t
@@ -243,6 +248,7 @@ mfib_test_entry (fib_node_index_t fei,
va_start(ap, n_buckets);
+ res = 0;
mfe = mfib_entry_get(fei);
mfib_entry_get_prefix(fei, &pfx);
@@ -258,7 +264,6 @@ mfib_test_entry (fib_node_index_t fei,
"%U links to %U",
format_mfib_prefix, &pfx,
format_dpo_id, &mfe->mfe_rep, 0);
- res = !0;
}
else
{
@@ -293,7 +298,9 @@ mfib_test_entry_itf (fib_node_index_t fei,
const mfib_entry_t *mfe;
const mfib_itf_t *mfi;
mfib_prefix_t pfx;
+ int res;
+ res = 0;
mfe = mfib_entry_get(fei);
mfi = mfib_entry_get_itf(mfe, sw_if_index);
mfib_entry_get_prefix(fei, &pfx);
@@ -308,7 +315,7 @@ mfib_test_entry_itf (fib_node_index_t fei,
format_mfib_itf_flags, flags,
format_mfib_itf_flags, mfi->mfi_flags);
- return (!0);
+ return (res);
}
static int
@@ -318,7 +325,9 @@ mfib_test_entry_no_itf (fib_node_index_t fei,
const mfib_entry_t *mfe;
const mfib_itf_t *mfi;
mfib_prefix_t pfx;
+ int res;
+ res = 0;
mfe = mfib_entry_get(fei);
mfi = mfib_entry_get_itf(mfe, sw_if_index);
mfib_entry_get_prefix(fei, &pfx);
@@ -327,7 +336,7 @@ mfib_test_entry_no_itf (fib_node_index_t fei,
"%U has no interface %d",
format_mfib_prefix, &pfx, sw_if_index);
- return (!0);
+ return (res);
}
static int
@@ -344,10 +353,12 @@ mfib_test_i (fib_protocol_t PROTO,
u32 fib_index, n_entries, n_itfs, n_reps, n_pls;
fib_node_index_t ai_1, ai_2, ai_3;
test_main_t *tm;
+ int res;
mfib_prefix_t all_1s;
memset(&all_1s, 0xfd, sizeof(all_1s));
+ res = 0;
n_entries = pool_elts(mfib_entry_pool);
n_itfs = pool_elts(mfib_itf_pool);
n_reps = pool_elts(replicate_pool);
@@ -375,15 +386,15 @@ mfib_test_i (fib_protocol_t PROTO,
};
mfei_dflt = mfib_table_lookup_exact_match(fib_index, &pfx_dft);
MFIB_TEST(FIB_NODE_INDEX_INVALID != mfei_dflt, "(*,*) presnet");
- MFIB_TEST(mfib_test_entry(mfei_dflt,
- MFIB_ENTRY_FLAG_DROP,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei_dflt,
+ MFIB_ENTRY_FLAG_DROP,
+ 0),
"(*,*) no replcaitions");
MFIB_TEST(FIB_NODE_INDEX_INVALID != mfei_dflt, "(*,*) presnet");
- MFIB_TEST(mfib_test_entry(mfei_dflt,
- MFIB_ENTRY_FLAG_DROP,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei_dflt,
+ MFIB_ENTRY_FLAG_DROP,
+ 0),
"(*,*) no replcaitions");
@@ -403,13 +414,13 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_ITF_FLAG_ACCEPT);
mfei_no_f = mfib_table_lookup_exact_match(fib_index, pfx_no_forward);
- MFIB_TEST(mfib_test_entry(mfei_no_f,
- MFIB_ENTRY_FLAG_NONE,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei_no_f,
+ MFIB_ENTRY_FLAG_NONE,
+ 0),
"%U no replcaitions",
format_mfib_prefix, pfx_no_forward);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei_no_f, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei_no_f, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
fib_route_path_t path_via_if1 = {
.frp_proto = fib_proto_to_dpo(PROTO),
@@ -474,23 +485,23 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_TEST(FIB_NODE_INDEX_INVALID != mfei_s_g,
"%U present",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei_s_g,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei_s_g,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate ok",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei_s_g, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei_s_g, tm->hw[1]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei_s_g, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei_s_g, tm->hw[3]->sw_if_index,
- (MFIB_ITF_FLAG_FORWARD |
- MFIB_ITF_FLAG_NEGATE_SIGNAL)));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei_s_g, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei_s_g, tm->hw[1]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei_s_g, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei_s_g, tm->hw[3]->sw_if_index,
+ (MFIB_ITF_FLAG_FORWARD |
+ MFIB_ITF_FLAG_NEGATE_SIGNAL)));
/*
* A (*,G), which the same G as the (S,G).
@@ -515,10 +526,10 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_TEST(mfei == mfei_g_1,
"%U found via exact match",
format_mfib_prefix, pfx_star_g_1);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_ADJACENCY_MCAST, ai_1),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_1),
"%U replicate ok",
format_mfib_prefix, pfx_star_g_1);
@@ -528,10 +539,10 @@ mfib_test_i (fib_protocol_t PROTO,
"%U found via LP match",
format_mfib_prefix, pfx_star_g_1);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_ADJACENCY_MCAST, ai_1),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_1),
"%U replicate ok",
format_mfib_prefix, pfx_star_g_1);
@@ -540,12 +551,12 @@ mfib_test_i (fib_protocol_t PROTO,
"%U found via exact match",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
mfei = mfib_table_lookup(fib_index, pfx_s_g);
@@ -553,12 +564,12 @@ mfib_test_i (fib_protocol_t PROTO,
"%U found via LP match",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -585,40 +596,40 @@ mfib_test_i (fib_protocol_t PROTO,
"%U found via DP LPM: %d",
format_mfib_prefix, pfx_star_g_1, mfei);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_ADJACENCY_MCAST, ai_1),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_1),
"%U replicate ok",
format_mfib_prefix, pfx_star_g_1);
mfei = mfib_table_lookup(fib_index, pfx_star_g_1);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_ADJACENCY_MCAST, ai_1),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_1),
"%U replicate ok",
format_mfib_prefix, pfx_star_g_1);
mfei = mfib_table_lookup_exact_match(fib_index, pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
mfei = mfib_table_lookup(fib_index, pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -626,10 +637,10 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_TEST(mfei = mfei_g_m,
"%U Found via exact match",
format_mfib_prefix, pfx_star_g_slash_m);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_star_g_slash_m);
MFIB_TEST(mfei_g_m == mfib_table_lookup(fib_index, pfx_star_g_slash_m),
@@ -645,13 +656,13 @@ mfib_test_i (fib_protocol_t PROTO,
&path_for_us,
MFIB_ITF_FLAG_FORWARD);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 4,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3,
- DPO_RECEIVE, 0),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 4,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3,
+ DPO_RECEIVE, 0),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -663,12 +674,12 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
&path_for_us);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -682,21 +693,21 @@ mfib_test_i (fib_protocol_t PROTO,
&path_via_if3,
MFIB_ITF_FLAG_ACCEPT);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 2,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 2,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[3]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[3]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
/*
* Make the path forwarding again
* - expect it to be added back to the replication set
@@ -712,24 +723,24 @@ mfib_test_i (fib_protocol_t PROTO,
mfei = mfib_table_lookup_exact_match(fib_index,
pfx_s_g);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[3]->sw_if_index,
- (MFIB_ITF_FLAG_FORWARD |
- MFIB_ITF_FLAG_ACCEPT |
- MFIB_ITF_FLAG_NEGATE_SIGNAL)));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[3]->sw_if_index,
+ (MFIB_ITF_FLAG_FORWARD |
+ MFIB_ITF_FLAG_ACCEPT |
+ MFIB_ITF_FLAG_NEGATE_SIGNAL)));
/*
* update flags on the entry
@@ -739,12 +750,12 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
MFIB_RPF_ID_NONE,
MFIB_ENTRY_FLAG_SIGNAL);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_SIGNAL,
- 3,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2,
- DPO_ADJACENCY_MCAST, ai_3),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_SIGNAL,
+ 3,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2,
+ DPO_ADJACENCY_MCAST, ai_3),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -756,37 +767,37 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
&path_via_if3);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_SIGNAL,
- 2,
- DPO_ADJACENCY_MCAST, ai_1,
- DPO_ADJACENCY_MCAST, ai_2),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_SIGNAL,
+ 2,
+ DPO_ADJACENCY_MCAST, ai_1,
+ DPO_ADJACENCY_MCAST, ai_2),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[1]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
mfib_table_entry_path_remove(fib_index,
pfx_s_g,
MFIB_SOURCE_API,
&path_via_if1);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_SIGNAL,
- 1,
- DPO_ADJACENCY_MCAST, ai_2),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_SIGNAL,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_2),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
- MFIB_ITF_FLAG_ACCEPT));
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[0]->sw_if_index,
+ MFIB_ITF_FLAG_ACCEPT));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
/*
* remove the accpeting only interface
@@ -796,17 +807,17 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
&path_via_if0);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_SIGNAL,
- 1,
- DPO_ADJACENCY_MCAST, ai_2),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_SIGNAL,
+ 1,
+ DPO_ADJACENCY_MCAST, ai_2),
"%U replicate OK",
format_mfib_prefix, pfx_s_g);
- MFIB_TEST_NS(mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
- MFIB_ITF_FLAG_FORWARD));
- MFIB_TEST_NS(mfib_test_entry_no_itf(mfei, tm->hw[0]->sw_if_index));
- MFIB_TEST_NS(mfib_test_entry_no_itf(mfei, tm->hw[1]->sw_if_index));
- MFIB_TEST_NS(mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
+ MFIB_TEST_NS(!mfib_test_entry_itf(mfei, tm->hw[2]->sw_if_index,
+ MFIB_ITF_FLAG_FORWARD));
+ MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[0]->sw_if_index));
+ MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[1]->sw_if_index));
+ MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
/*
* remove the last path, the entry still has flags so it remains
@@ -816,9 +827,9 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
&path_via_if2);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_SIGNAL,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_SIGNAL,
+ 0),
"%U no replications",
format_mfib_prefix, pfx_s_g);
@@ -831,10 +842,10 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_RPF_ID_NONE,
(MFIB_ENTRY_FLAG_SIGNAL |
MFIB_ENTRY_FLAG_CONNECTED));
- MFIB_TEST(mfib_test_entry(mfei,
- (MFIB_ENTRY_FLAG_SIGNAL |
- MFIB_ENTRY_FLAG_CONNECTED),
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ (MFIB_ENTRY_FLAG_SIGNAL |
+ MFIB_ENTRY_FLAG_CONNECTED),
+ 0),
"%U no replications",
format_mfib_prefix, pfx_s_g);
@@ -847,9 +858,9 @@ mfib_test_i (fib_protocol_t PROTO,
&path_via_if0,
(MFIB_ITF_FLAG_ACCEPT |
MFIB_ITF_FLAG_NEGATE_SIGNAL));
- MFIB_TEST(mfib_test_entry(mfei_g_2,
- MFIB_ENTRY_FLAG_NONE,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei_g_2,
+ MFIB_ENTRY_FLAG_NONE,
+ 0),
"%U No replications",
format_mfib_prefix, pfx_star_g_2);
@@ -875,9 +886,9 @@ mfib_test_i (fib_protocol_t PROTO,
&path_via_if0,
(MFIB_ITF_FLAG_ACCEPT |
MFIB_ITF_NEGATE_SIGNAL));
- MFIB_TEST(mfib_test_entry(mfei_g_3,
- MFIB_ENTRY_FLAG_NONE,
- 0),
+ MFIB_TEST(!mfib_test_entry(mfei_g_3,
+ MFIB_ENTRY_FLAG_NONE,
+ 0),
"%U No replications",
format_mfib_prefix, pfx_star_g_3);
@@ -912,9 +923,9 @@ mfib_test_i (fib_protocol_t PROTO,
* Find the (*,G/m)
*/
MFIB_TEST((mfei_g_m == ip6_mfib_table_lookup2(
- ip6_mfib_get(fib_index),
- &src,
- &pfx_star_g_slash_m->fp_grp_addr.ip6)),
+ ip6_mfib_get(fib_index),
+ &src,
+ &pfx_star_g_slash_m->fp_grp_addr.ip6)),
"%U found via DP LPM grp=%U",
format_mfib_prefix, pfx_star_g_slash_m,
format_ip6_address, &pfx_star_g_slash_m->fp_grp_addr.ip6);
@@ -923,9 +934,9 @@ mfib_test_i (fib_protocol_t PROTO,
tmp.as_u8[15] = 0xff;
MFIB_TEST((mfei_g_m == ip6_mfib_table_lookup2(
- ip6_mfib_get(fib_index),
- &pfx_s_g->fp_src_addr.ip6,
- &tmp)),
+ ip6_mfib_get(fib_index),
+ &pfx_s_g->fp_src_addr.ip6,
+ &tmp)),
"%U found via DP LPM grp=%U",
format_mfib_prefix, pfx_star_g_slash_m,
format_ip6_address, &tmp);
@@ -1045,11 +1056,11 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_SRv6,
MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF,
repi);
- MFIB_TEST(mfib_test_entry(mfei,
- (MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF |
- MFIB_ENTRY_FLAG_EXCLUSIVE),
- 1,
- DPO_ADJACENCY_MCAST, ai_2),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ (MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF |
+ MFIB_ENTRY_FLAG_EXCLUSIVE),
+ 1,
+ DPO_ADJACENCY_MCAST, ai_2),
"%U exclusive replicate OK",
format_mfib_prefix, pfx_star_g_3);
@@ -1066,11 +1077,11 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_SRv6,
MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF,
repi2);
- MFIB_TEST(mfib_test_entry(mfei,
- (MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF |
- MFIB_ENTRY_FLAG_EXCLUSIVE),
- 1,
- DPO_ADJACENCY_MCAST, ai_1),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ (MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF |
+ MFIB_ENTRY_FLAG_EXCLUSIVE),
+ 1,
+ DPO_ADJACENCY_MCAST, ai_1),
"%U exclusive update replicate OK",
format_mfib_prefix, pfx_star_g_3);
@@ -1132,10 +1143,10 @@ mfib_test_i (fib_protocol_t PROTO,
1,
l3300,
FIB_ROUTE_PATH_FLAG_NONE);
- MFIB_TEST(fib_test_validate_entry(lfei,
- FIB_FORW_CHAIN_TYPE_MPLS_EOS,
- 1,
- &mc_0),
+ MFIB_TEST(!fib_test_validate_entry(lfei,
+ FIB_FORW_CHAIN_TYPE_MPLS_EOS,
+ 1,
+ &mc_0),
"3500 via replicate over 10.10.10.1");
/*
@@ -1162,10 +1173,10 @@ mfib_test_i (fib_protocol_t PROTO,
&path_via_mldp,
MFIB_ITF_FLAG_FORWARD);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 1,
- DPO_REPLICATE, mldp_dpo.dpoi_index),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 1,
+ DPO_REPLICATE, mldp_dpo.dpoi_index),
"%U over-mLDP replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -1177,11 +1188,11 @@ mfib_test_i (fib_protocol_t PROTO,
MFIB_SOURCE_API,
&path_for_us,
MFIB_ITF_FLAG_FORWARD);
- MFIB_TEST(mfib_test_entry(mfei,
- MFIB_ENTRY_FLAG_NONE,
- 2,
- DPO_REPLICATE, mldp_dpo.dpoi_index,
- DPO_RECEIVE, 0),
+ MFIB_TEST(!mfib_test_entry(mfei,
+ MFIB_ENTRY_FLAG_NONE,
+ 2,
+ DPO_REPLICATE, mldp_dpo.dpoi_index,
+ DPO_RECEIVE, 0),
"%U mLDP+for-us replicate OK",
format_mfib_prefix, pfx_s_g);
@@ -1229,7 +1240,7 @@ mfib_test_i (fib_protocol_t PROTO,
" No more Interfaces %d!=%d",
n_itfs, pool_elts(mfib_itf_pool));
- return (0);
+ return (res);
}
static int
diff --git a/src/vnet/udp/udp_encap.c b/src/vnet/udp/udp_encap.c
index 87b2c09e78c..8392b391736 100644
--- a/src/vnet/udp/udp_encap.c
+++ b/src/vnet/udp/udp_encap.c
@@ -263,7 +263,7 @@ format_udp_encap_i (u8 * s, va_list * args)
ue = udp_encap_get (uei);
// FIXME
- s = format (s, "udp-ecap:[%d]: id:%d ip-fib-index:%d",
+ s = format (s, "udp-ecap:[%d]: id:%d ip-fib-index:%d ",
uei, ue->ue_id, ue->ue_fib_index);
if (FIB_PROTOCOL_IP4 == ue->ue_ip_proto)
{