summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_attached_export.c19
-rw-r--r--src/vnet/fib/fib_entry.c14
-rw-r--r--src/vnet/fib/fib_entry.h3
-rw-r--r--src/vnet/fib/fib_entry_cover.c8
-rw-r--r--src/vnet/fib/fib_path.c5
-rw-r--r--src/vnet/fib/fib_table.c6
-rw-r--r--src/vnet/fib/fib_test.c16
-rw-r--r--src/vnet/fib/ip4_fib.c8
8 files changed, 31 insertions, 48 deletions
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index 3b8c6b43542..e522db44570 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -126,7 +126,6 @@ static void
fib_entry_import_remove (fib_ae_import_t *import,
fib_node_index_t entry_index)
{
- fib_prefix_t prefix;
u32 index;
/*
@@ -139,10 +138,8 @@ fib_entry_import_remove (fib_ae_import_t *import,
/*
* this is an entry that was previsouly imported
*/
- fib_entry_get_prefix(entry_index, &prefix);
-
fib_table_entry_special_remove(import->faei_import_fib,
- &prefix,
+ fib_entry_get_prefix(entry_index),
FIB_SOURCE_AE);
fib_entry_unlock(entry_index);
@@ -155,7 +152,7 @@ fib_entry_import_add (fib_ae_import_t *import,
fib_node_index_t entry_index)
{
fib_node_index_t *existing;
- fib_prefix_t prefix;
+ const fib_prefix_t *prefix;
/*
* ensure we only add the exported entry once, since
@@ -173,12 +170,12 @@ fib_entry_import_add (fib_ae_import_t *import,
* this is the first time this export entry has been imported
* Add it to the import FIB and to the list of importeds
*/
- fib_entry_get_prefix(entry_index, &prefix);
+ prefix = fib_entry_get_prefix(entry_index);
/*
* don't import entries that have the same prefix the import entry
*/
- if (0 != fib_prefix_cmp(&prefix,
+ if (0 != fib_prefix_cmp(prefix,
&import->faei_prefix))
{
const dpo_id_t *dpo;
@@ -188,7 +185,7 @@ fib_entry_import_add (fib_ae_import_t *import,
if (dpo_id_is_valid(dpo) && !dpo_is_drop(dpo))
{
fib_table_entry_special_dpo_add(import->faei_import_fib,
- &prefix,
+ prefix,
FIB_SOURCE_AE,
(fib_entry_get_flags(entry_index) |
FIB_ENTRY_FLAG_EXCLUSIVE),
@@ -337,12 +334,8 @@ fib_attached_export_purge (fib_entry_t *fib_entry)
*/
vec_foreach(import_index, import->faei_importeds)
{
- fib_prefix_t prefix;
-
- fib_entry_get_prefix(*import_index, &prefix);
-
fib_table_entry_delete(import->faei_import_fib,
- &prefix,
+ fib_entry_get_prefix(*import_index),
FIB_SOURCE_AE);
fib_entry_unlock(*import_index);
}
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index a12edcb1867..655526586cb 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -1433,11 +1433,7 @@ fib_entry_get_best_source (fib_node_index_t entry_index)
int
fib_entry_is_host (fib_node_index_t fib_entry_index)
{
- fib_prefix_t pfx;
-
- fib_entry_get_prefix(fib_entry_index, &pfx);
-
- return (fib_prefix_is_host(&pfx));
+ return (fib_prefix_is_host(fib_entry_get_prefix(fib_entry_index)));
}
/**
@@ -1612,14 +1608,14 @@ fib_entry_encode (fib_node_index_t fib_entry_index,
}
}
-void
-fib_entry_get_prefix (fib_node_index_t fib_entry_index,
- fib_prefix_t *pfx)
+const fib_prefix_t *
+fib_entry_get_prefix (fib_node_index_t fib_entry_index)
{
fib_entry_t *fib_entry;
fib_entry = fib_entry_get(fib_entry_index);
- *pfx = fib_entry->fe_prefix;
+
+ return (&fib_entry->fe_prefix);
}
u32
diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h
index dcc310e8fbc..950f0dc7974 100644
--- a/src/vnet/fib/fib_entry.h
+++ b/src/vnet/fib/fib_entry.h
@@ -594,8 +594,7 @@ extern u32 fib_entry_get_resolving_interface_for_source(
extern void fib_entry_encode(fib_node_index_t fib_entry_index,
fib_route_path_encode_t **api_rpaths);
-extern void fib_entry_get_prefix(fib_node_index_t fib_entry_index,
- fib_prefix_t *pfx);
+extern const fib_prefix_t *fib_entry_get_prefix(fib_node_index_t fib_entry_index);
extern u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index);
extern void fib_entry_set_source_data(fib_node_index_t fib_entry_index,
fib_source_t source,
diff --git a/src/vnet/fib/fib_entry_cover.c b/src/vnet/fib/fib_entry_cover.c
index 814df578a62..ad12b94802a 100644
--- a/src/vnet/fib/fib_entry_cover.c
+++ b/src/vnet/fib/fib_entry_cover.c
@@ -133,12 +133,12 @@ fib_entry_cover_change_one (fib_entry_t *cover,
}
else if (new_cover != covered)
{
- fib_prefix_t pfx_covered, pfx_new_cover;
+ const fib_prefix_t *pfx_covered, *pfx_new_cover;
- fib_entry_get_prefix(covered, &pfx_covered);
- fib_entry_get_prefix(new_cover, &pfx_new_cover);
+ pfx_covered = fib_entry_get_prefix(covered);
+ pfx_new_cover = fib_entry_get_prefix(new_cover);
- if (fib_prefix_is_cover(&pfx_new_cover, &pfx_covered))
+ if (fib_prefix_is_cover(pfx_new_cover, pfx_covered))
{
fib_entry_cover_changed(covered);
}
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index 2912c6a76b7..47142284202 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -874,13 +874,10 @@ fib_path_unresolve (fib_path_t *path)
case FIB_PATH_TYPE_RECURSIVE:
if (FIB_NODE_INDEX_INVALID != path->fp_via_fib)
{
- fib_prefix_t pfx;
-
- fib_entry_get_prefix(path->fp_via_fib, &pfx);
fib_entry_child_remove(path->fp_via_fib,
path->fp_sibling);
fib_table_entry_special_remove(path->recursive.fp_tbl_id,
- &pfx,
+ fib_entry_get_prefix(path->fp_via_fib),
FIB_SOURCE_RR);
path->fp_via_fib = FIB_NODE_INDEX_INVALID;
}
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index c37ac1dbd49..f63edaa76f0 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -877,12 +877,12 @@ void
fib_table_entry_delete_index (fib_node_index_t fib_entry_index,
fib_source_t source)
{
- fib_prefix_t prefix;
+ const fib_prefix_t *prefix;
- fib_entry_get_prefix(fib_entry_index, &prefix);
+ prefix = fib_entry_get_prefix(fib_entry_index);
fib_table_entry_delete_i(fib_entry_get_fib_index(fib_entry_index),
- fib_entry_index, &prefix, source);
+ fib_entry_index, prefix, source);
}
fib_node_index_t
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index fb268e63d9e..112709e7cfe 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -665,7 +665,7 @@ fib_test_validate_entry (fib_node_index_t fei,
...)
{
dpo_id_t dpo = DPO_INVALID;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
index_t fw_lbi;
u32 fib_index;
va_list ap;
@@ -674,7 +674,7 @@ fib_test_validate_entry (fib_node_index_t fei,
va_start(ap, n_buckets);
res = 0;
- fib_entry_get_prefix(fei, &pfx);
+ pfx = fib_entry_get_prefix(fei);
fib_index = fib_entry_get_fib_index(fei);
fib_entry_contribute_forwarding(fei, fct, &dpo);
@@ -691,7 +691,7 @@ fib_test_validate_entry (fib_node_index_t fei,
FIB_TEST_LB((DPO_LOAD_BALANCE == dpo.dpoi_type),
"%U Entry links to %U",
- format_fib_prefix, &pfx,
+ format_fib_prefix, pfx,
format_dpo_type, dpo.dpoi_type);
lb = load_balance_get(dpo.dpoi_index);
@@ -703,13 +703,13 @@ fib_test_validate_entry (fib_node_index_t fei,
*/
if (fct == fib_entry_get_default_chain_type(fib_entry_get(fei)))
{
- switch (pfx.fp_proto)
+ switch (pfx->fp_proto)
{
case FIB_PROTOCOL_IP4:
- fw_lbi = ip4_fib_forwarding_lookup(fib_index, &pfx.fp_addr.ip4);
+ fw_lbi = ip4_fib_forwarding_lookup(fib_index, &pfx->fp_addr.ip4);
break;
case FIB_PROTOCOL_IP6:
- fw_lbi = ip6_fib_table_fwding_lookup(&ip6_main, fib_index, &pfx.fp_addr.ip6);
+ fw_lbi = ip6_fib_table_fwding_lookup(&ip6_main, fib_index, &pfx->fp_addr.ip6);
break;
case FIB_PROTOCOL_MPLS:
{
@@ -717,8 +717,8 @@ fib_test_validate_entry (fib_node_index_t fei,
.label_exp_s_ttl = 0,
};
- vnet_mpls_uc_set_label(&hdr.label_exp_s_ttl, pfx.fp_label);
- vnet_mpls_uc_set_s(&hdr.label_exp_s_ttl, pfx.fp_eos);
+ vnet_mpls_uc_set_label(&hdr.label_exp_s_ttl, pfx->fp_label);
+ vnet_mpls_uc_set_s(&hdr.label_exp_s_ttl, pfx->fp_eos);
hdr.label_exp_s_ttl = clib_host_to_net_u32(hdr.label_exp_s_ttl);
fw_lbi = mpls_fib_table_forwarding_lookup(fib_index, &hdr);
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index 01f4a755ec2..d8d983dd9c1 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -391,9 +391,7 @@ ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib,
const dpo_id_t *dpo,
u32 cover_index)
{
- fib_prefix_t cover_prefix = {
- .fp_len = 0,
- };
+ const fib_prefix_t *cover_prefix;
const dpo_id_t *cover_dpo;
/*
@@ -401,12 +399,12 @@ ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib,
* covering prefix, so it can fill the plys with the correct replacement
* for the entry being removed
*/
- fib_entry_get_prefix(cover_index, &cover_prefix);
+ cover_prefix = fib_entry_get_prefix(cover_index);
cover_dpo = fib_entry_contribute_ip_forwarding(cover_index);
ip4_fib_mtrie_route_del(&fib->mtrie,
addr, len, dpo->dpoi_index,
- cover_prefix.fp_len,
+ cover_prefix->fp_len,
cover_dpo->dpoi_index);
}