summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_subnet.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-12-04 06:11:00 +0000
committerOle Trøan <otroan@employees.org>2019-12-04 22:47:12 +0000
commit3bab8f9c5396a7bf1115b93a9e0691a76a9ed14c (patch)
tree0212708b47f042ac393848e0471669f837788278 /src/plugins/gbp/gbp_subnet.c
parent5f8f6173328f8d77feea5fd100e150c3094c11f0 (diff)
fib: Decouple source from priority and behaviour
Type: feature the fib_source_t enum alone no longer defines the priority and behaviour, instead each source must be allocated these attributes. This allows the creation of other sources by the plugins (and soon over the API). Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I890ee820fbc16079ee417ea1fbc163192806e853
Diffstat (limited to 'src/plugins/gbp/gbp_subnet.c')
-rw-r--r--src/plugins/gbp/gbp_subnet.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/gbp/gbp_subnet.c b/src/plugins/gbp/gbp_subnet.c
index bb069ffe892..2ef3fcfd534 100644
--- a/src/plugins/gbp/gbp_subnet.c
+++ b/src/plugins/gbp/gbp_subnet.c
@@ -65,6 +65,8 @@ uword *gbp_subnet_db;
*/
gbp_subnet_t *gbp_subnet_pool;
+static fib_source_t gbp_fib_source;
+
static index_t
gbp_subnet_db_find (u32 fib_index, const fib_prefix_t * pfx)
{
@@ -122,7 +124,7 @@ gbp_subnet_transport_add (gbp_subnet_t * gs)
gs->gs_fei = fib_table_entry_update_one_path (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
- FIB_SOURCE_PLUGIN_HI,
+ gbp_fib_source,
FIB_ENTRY_FLAG_NONE,
fib_proto_to_dpo (fproto),
&ADJ_BCAST_ADDR,
@@ -145,7 +147,7 @@ gbp_subnet_internal_add (gbp_subnet_t * gs)
gs->gs_fei = fib_table_entry_special_dpo_update (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
- FIB_SOURCE_PLUGIN_HI,
+ gbp_fib_source,
FIB_ENTRY_FLAG_EXCLUSIVE,
&gfd);
@@ -169,7 +171,7 @@ gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, sclass_t sclass)
gs->gs_fei = fib_table_entry_special_dpo_update (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
- FIB_SOURCE_PLUGIN_HI,
+ gbp_fib_source,
(FIB_ENTRY_FLAG_EXCLUSIVE |
FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT),
&gpd);
@@ -216,7 +218,7 @@ gbp_subnet_del_i (index_t gsi)
(GBP_SUBNET_L3_OUT == gs->gs_type
|| GBP_SUBNET_ANON_L3_OUT ==
gs->gs_type) ? FIB_SOURCE_SPECIAL :
- FIB_SOURCE_PLUGIN_HI);
+ gbp_fib_source);
gbp_subnet_db_del (gs);
gbp_route_domain_unlock (gs->gs_rd);
@@ -578,6 +580,9 @@ gbp_subnet_init (vlib_main_t * vm)
{
gbp_subnet_db = hash_create_mem (0,
sizeof (gbp_subnet_key_t), sizeof (u32));
+ gbp_fib_source = fib_source_allocate ("gbp-subnet",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
return (NULL);
}