summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/gbp/gbp_subnet.c10
-rw-r--r--src/plugins/map/map.c6
-rw-r--r--src/vnet/ethernet/arp.c15
-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
-rw-r--r--src/vnet/ip/ip_api.c20
-rw-r--r--src/vnet/mpls/mpls_api.c16
13 files changed, 64 insertions, 82 deletions
diff --git a/src/plugins/gbp/gbp_subnet.c b/src/plugins/gbp/gbp_subnet.c
index b6990844cd3..3819a51595b 100644
--- a/src/plugins/gbp/gbp_subnet.c
+++ b/src/plugins/gbp/gbp_subnet.c
@@ -97,13 +97,13 @@ static fib_table_walk_rc_t
gbp_subnet_fib_table_walk (fib_node_index_t fei, void *arg)
{
gbp_subnet_fib_table_walk_ctx_t *ctx = arg;
+ const fib_prefix_t *pfx;
const dpo_id_t *dpo;
- fib_prefix_t pfx;
u32 table_id;
- fib_entry_get_prefix (fei, &pfx);
+ pfx = fib_entry_get_prefix (fei);
table_id = fib_table_get_table_id (fib_entry_get_fib_index (fei),
- pfx.fp_proto);
+ pfx->fp_proto);
dpo = fib_entry_contribute_ip_forwarding (fei);
if (DPO_LOAD_BALANCE == dpo->dpoi_type)
@@ -117,7 +117,7 @@ gbp_subnet_fib_table_walk (fib_node_index_t fei, void *arg)
gpd = gbp_policy_dpo_get (dpo->dpoi_index);
/* *INDENT-OFF* */
- ctx->cb (table_id, &pfx,
+ ctx->cb (table_id, pfx,
gpd->gpd_sw_if_index,
gpd->gpd_epg,
0, // is_internal
@@ -127,7 +127,7 @@ gbp_subnet_fib_table_walk (fib_node_index_t fei, void *arg)
else if (dpo->dpoi_type == gbp_fwd_dpo_get_type ())
{
/* *INDENT-OFF* */
- ctx->cb (table_id, &pfx,
+ ctx->cb (table_id, pfx,
~0, // sw_if_index
~0, // epg
1, // is_internal
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c
index 6d9730f3b06..63d6e1a3965 100644
--- a/src/plugins/map/map.c
+++ b/src/plugins/map/map.c
@@ -363,12 +363,12 @@ format_map_pre_resolve (u8 * s, va_list * ap)
if (FIB_NODE_INDEX_INVALID != pr->fei)
{
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
- fib_entry_get_prefix (pr->fei, &pfx);
+ pfx = fib_entry_get_prefix (pr->fei);
return (format (s, "%U (%u)",
- format_ip46_address, &pfx.fp_addr, IP46_TYPE_ANY,
+ format_ip46_address, &pfx->fp_addr, IP46_TYPE_ANY,
pr->dpo.dpoi_index));
}
else
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c
index f7d8ff867f8..b5c2e6dc748 100644
--- a/src/vnet/ethernet/arp.c
+++ b/src/vnet/ethernet/arp.c
@@ -964,12 +964,13 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vnet_hw_interface_t *hw_if0;
ethernet_arp_header_t *arp0;
ethernet_header_t *eth_rx, *eth_tx;
- ip4_address_t *if_addr0, proxy_src;
+ const ip4_address_t *if_addr0;
+ ip4_address_t proxy_src;
u32 pi0, error0, next0, sw_if_index0, conn_sw_if_index0, fib_index0;
u8 is_request0, dst_is_local0, is_unnum0, is_vrrp_reply0;
ethernet_proxy_arp_t *pa;
fib_node_index_t dst_fei, src_fei;
- fib_prefix_t pfx0;
+ const fib_prefix_t *pfx0;
fib_entry_flag_t src_flags, dst_flags;
u8 *rewrite0, rewrite0_len;
@@ -1041,9 +1042,9 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
* to reach us, they only affect how we reach the sender.
*/
fib_entry_t *src_fib_entry;
+ const fib_prefix_t *pfx;
fib_entry_src_t *src;
fib_source_t source;
- fib_prefix_t pfx;
int attached;
int mask;
@@ -1106,8 +1107,8 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
/*
* shorter mask lookup for the next iteration.
*/
- fib_entry_get_prefix (src_fei, &pfx);
- mask = pfx.fp_len - 1;
+ pfx = fib_entry_get_prefix (src_fei);
+ mask = pfx->fp_len - 1;
/*
* continue until we hit the default route or we find
@@ -1165,8 +1166,8 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
}
dst_is_local0 = (FIB_ENTRY_FLAG_LOCAL & dst_flags);
- fib_entry_get_prefix (dst_fei, &pfx0);
- if_addr0 = &pfx0.fp_addr.ip4;
+ pfx0 = fib_entry_get_prefix (dst_fei);
+ if_addr0 = &pfx0->fp_addr.ip4;
is_vrrp_reply0 =
((arp0->opcode ==
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);
}
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 64d672446f9..7217f9d101a 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -247,7 +247,7 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp)
ip4_main_t *im = &ip4_main;
fib_table_t *fib_table;
fib_node_index_t *lfeip;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
u32 fib_index;
fib_route_path_encode_t *api_rpaths;
vl_api_ip_fib_dump_walk_ctx_t ctx = {
@@ -272,12 +272,12 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp)
vec_foreach (lfeip, ctx.feis)
{
- fib_entry_get_prefix (*lfeip, &pfx);
+ pfx = fib_entry_get_prefix (*lfeip);
fib_index = fib_entry_get_fib_index (*lfeip);
- fib_table = fib_table_get (fib_index, pfx.fp_proto);
+ fib_table = fib_table_get (fib_index, pfx->fp_proto);
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
- send_ip_fib_details (am, reg, fib_table, &pfx, api_rpaths, mp->context);
+ send_ip_fib_details (am, reg, fib_table, pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}
@@ -351,7 +351,7 @@ api_ip6_fib_table_get_all (vl_api_registration_t * reg,
.entries = NULL,
};
fib_route_path_encode_t *api_rpaths;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
BV (clib_bihash_foreach_key_value_pair)
((BVT (clib_bihash) *) & im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].
@@ -361,10 +361,10 @@ api_ip6_fib_table_get_all (vl_api_registration_t * reg,
vec_foreach (fib_entry_index, ctx.entries)
{
- fib_entry_get_prefix (*fib_entry_index, &pfx);
+ pfx = fib_entry_get_prefix (*fib_entry_index);
api_rpaths = NULL;
fib_entry_encode (*fib_entry_index, &api_rpaths);
- send_ip6_fib_details (am, reg, fib_table, &pfx, api_rpaths, mp->context);
+ send_ip6_fib_details (am, reg, fib_table, pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}
@@ -1690,7 +1690,7 @@ vl_api_ip6nd_proxy_dump_t_handler (vl_api_ip6nd_proxy_dump_t * mp)
.indices = NULL,
};
fib_node_index_t *feip;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
vl_api_registration_t *reg;
reg = vl_api_client_index_to_registration (mp->client_index);
@@ -1711,11 +1711,11 @@ vl_api_ip6nd_proxy_dump_t_handler (vl_api_ip6nd_proxy_dump_t * mp)
vec_foreach (feip, ctx.indices)
{
- fib_entry_get_prefix (*feip, &pfx);
+ pfx = fib_entry_get_prefix (*feip);
send_ip6nd_proxy_details (reg,
mp->context,
- &pfx.fp_addr,
+ &pfx->fp_addr,
fib_entry_get_resolving_interface (*feip));
}
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 9f5100a7f83..a35e94d3411 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -460,7 +460,7 @@ static void
send_mpls_fib_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
const fib_table_t * table,
- u32 label, u32 eos,
+ const fib_prefix_t * pfx,
fib_route_path_encode_t * api_rpaths, u32 context)
{
vl_api_mpls_fib_details_t *mp;
@@ -479,8 +479,8 @@ send_mpls_fib_details (vpe_api_main_t * am,
mp->table_id = htonl (table->ft_table_id);
memcpy (mp->table_name, table->ft_desc,
clib_min (vec_len (table->ft_desc), sizeof (mp->table_name)));
- mp->eos_bit = eos;
- mp->label = htonl (label);
+ mp->eos_bit = pfx->fp_eos;
+ mp->label = htonl (pfx->fp_label);
mp->count = htonl (path_count);
fp = mp->path;
@@ -517,7 +517,7 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
fib_table_t *fib_table;
mpls_fib_t *mpls_fib;
fib_node_index_t *lfeip = NULL;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
u32 fib_index;
fib_route_path_encode_t *api_rpaths;
vl_api_mpls_fib_dump_table_walk_ctx_t ctx = {
@@ -540,14 +540,12 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
vec_foreach (lfeip, ctx.lfeis)
{
- fib_entry_get_prefix (*lfeip, &pfx);
+ pfx = fib_entry_get_prefix (*lfeip);
fib_index = fib_entry_get_fib_index (*lfeip);
- fib_table = fib_table_get (fib_index, pfx.fp_proto);
+ fib_table = fib_table_get (fib_index, pfx->fp_proto);
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
- send_mpls_fib_details (am, reg,
- fib_table, pfx.fp_label,
- pfx.fp_eos, api_rpaths, mp->context);
+ send_mpls_fib_details (am, reg, fib_table, pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}