summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gbp/gbp_endpoint.c21
-rw-r--r--src/plugins/gbp/gbp_route_domain.c9
-rw-r--r--src/plugins/gbp/gbp_subnet.c13
-rw-r--r--src/plugins/ila/ila.c13
-rw-r--r--src/plugins/lb/lb.c12
-rw-r--r--src/plugins/nat/dslite.c10
-rwxr-xr-xsrc/plugins/nat/nat.c44
-rw-r--r--src/plugins/nat/nat.h4
-rw-r--r--src/plugins/nat/nat64.c9
-rw-r--r--src/plugins/nat/nat64_cli.c9
-rw-r--r--src/plugins/nat/nat66.c5
-rw-r--r--src/plugins/pppoe/pppoe.c10
-rw-r--r--src/plugins/svs/svs.c16
-rw-r--r--src/plugins/unittest/fib_test.c7
14 files changed, 119 insertions, 63 deletions
diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c
index 12865461d18..bef67770fd9 100644
--- a/src/plugins/gbp/gbp_endpoint.c
+++ b/src/plugins/gbp/gbp_endpoint.c
@@ -41,9 +41,10 @@ static const char *gbp_endpoint_attr_names[] = GBP_ENDPOINT_ATTR_NAMES;
*/
gbp_ep_db_t gbp_ep_db;
-fib_node_type_t gbp_endpoint_fib_type;
-
-vlib_log_class_t gbp_ep_logger;
+static fib_source_t gbp_fib_source_hi;
+static fib_source_t gbp_fib_source_low;
+static fib_node_type_t gbp_endpoint_fib_type;
+static vlib_log_class_t gbp_ep_logger;
#define GBP_ENDPOINT_DBG(...) \
vlib_log_debug (gbp_ep_logger, __VA_ARGS__);
@@ -588,10 +589,10 @@ gbb_endpoint_fwd_reset (gbp_endpoint_t * ge)
*/
if (gbp_endpoint_is_remote (ge))
{
- fib_table_entry_special_remove (fib_index, pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove (fib_index, pfx, gbp_fib_source_hi);
}
- fib_table_entry_delete (fib_index, pfx, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_delete (fib_index, pfx, gbp_fib_source_low);
}
vec_foreach (ai, gef->gef_adjs)
{
@@ -726,7 +727,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
}
fib_table_entry_path_add (fib_index, pfx,
- FIB_SOURCE_PLUGIN_LOW,
+ gbp_fib_source_low,
FIB_ENTRY_FLAG_NONE,
fib_proto_to_dpo (pfx->fp_proto),
&pfx->fp_addr, ip_sw_if_index,
@@ -759,7 +760,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
gg->gg_sclass, ~0, &policy_dpo);
fib_table_entry_special_dpo_add (fib_index, pfx,
- FIB_SOURCE_PLUGIN_HI,
+ gbp_fib_source_hi,
FIB_ENTRY_FLAG_INTERPOSE,
&policy_dpo);
dpo_reset (&policy_dpo);
@@ -1576,6 +1577,12 @@ gbp_endpoint_init (vlib_main_t * vm)
gbp_ep_logger = vlib_log_register_class ("gbp", "ep");
gbp_endpoint_fib_type = fib_node_register_new_type (&gbp_endpoint_vft);
+ gbp_fib_source_hi = fib_source_allocate ("gbp-endpoint-hi",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
+ gbp_fib_source_low = fib_source_allocate ("gbp-endpoint-low",
+ FIB_SOURCE_PRIORITY_LOW,
+ FIB_SOURCE_BH_SIMPLE);
return (NULL);
}
diff --git a/src/plugins/gbp/gbp_route_domain.c b/src/plugins/gbp/gbp_route_domain.c
index ab998591982..f0aa694d44a 100644
--- a/src/plugins/gbp/gbp_route_domain.c
+++ b/src/plugins/gbp/gbp_route_domain.c
@@ -53,6 +53,7 @@ typedef struct gbp_route_domain_db_t
} gbp_route_domain_db_t;
static gbp_route_domain_db_t gbp_route_domain_db;
+static fib_source_t gbp_fib_source;
/**
* logger
@@ -154,7 +155,7 @@ gbp_route_domain_add_and_lock (u32 rd_id,
grd->grd_fib_index[fproto] =
fib_table_find_or_create_and_lock (fproto,
grd->grd_table_id[fproto],
- FIB_SOURCE_PLUGIN_HI);
+ gbp_fib_source);
if (~0 != grd->grd_uu_sw_if_index[fproto])
{
@@ -221,8 +222,7 @@ gbp_route_domain_unlock (index_t index)
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
- fib_table_unlock (grd->grd_fib_index[fproto],
- fproto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (grd->grd_fib_index[fproto], fproto, gbp_fib_source);
if (INDEX_INVALID != grd->grd_adj[fproto])
adj_unlock (grd->grd_adj[fproto]);
}
@@ -430,6 +430,9 @@ static clib_error_t *
gbp_route_domain_init (vlib_main_t * vm)
{
grd_logger = vlib_log_register_class ("gbp", "rd");
+ gbp_fib_source = fib_source_allocate ("gbp-rd",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_DROP);
return (NULL);
}
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);
}
diff --git a/src/plugins/ila/ila.c b/src/plugins/ila/ila.c
index bac76151c28..162d417d772 100644
--- a/src/plugins/ila/ila.c
+++ b/src/plugins/ila/ila.c
@@ -68,6 +68,11 @@ static dpo_type_t ila_dpo_type;
*/
static fib_node_type_t ila_fib_node_type;
+/**
+ * FIB source for adding entries
+ */
+static fib_source_t ila_fib_src;
+
u8 *
format_half_ip6_address (u8 * s, va_list * va)
{
@@ -758,7 +763,7 @@ ila_add_del_entry (ila_add_del_entry_args_t * args)
fib_table_entry_special_dpo_add(0,
&pfx,
- FIB_SOURCE_PLUGIN_HI,
+ ila_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE,
&dpo);
dpo_reset(&dpo);
@@ -794,7 +799,7 @@ ila_add_del_entry (ila_add_del_entry_args_t * args)
.fp_proto = FIB_PROTOCOL_IP6,
};
- fib_table_entry_special_remove(0, &pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove(0, &pfx, ila_fib_src);
/*
* remove this ILA entry as child of the FIB netry for the next-hop
*/
@@ -935,7 +940,9 @@ ila_init (vlib_main_t * vm)
ila_dpo_type = dpo_register_new_type(&ila_vft, ila_nodes);
ila_fib_node_type = fib_node_register_new_type(&ila_fib_node_vft);
-
+ ila_fib_src = fib_source_allocate("ila",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
return NULL;
}
diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c
index b1e0b237478..4dbf134cc4f 100644
--- a/src/plugins/lb/lb.c
+++ b/src/plugins/lb/lb.c
@@ -26,6 +26,9 @@
//After so many seconds. It is assumed that inter-core race condition will not occur.
#define LB_CONCURRENCY_TIMEOUT 10
+// FIB source for adding routes
+static fib_source_t lb_fib_src;
+
lb_main_t lb_main;
#define lb_get_writer_lock() clib_spinlock_lock (&lb_main.writer_lock)
@@ -948,7 +951,7 @@ static void lb_vip_add_adjacency(lb_main_t *lbm, lb_vip_t *vip,
dpo_set(&dpo, dpo_type, proto, *vip_prefix_index);
fib_table_entry_special_dpo_add(0,
&pfx,
- FIB_SOURCE_PLUGIN_HI,
+ lb_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE,
&dpo);
dpo_reset(&dpo);
@@ -1037,7 +1040,7 @@ static void lb_vip_del_adjacency(lb_main_t *lbm, lb_vip_t *vip)
pfx.fp_len = vip->plen;
pfx.fp_proto = FIB_PROTOCOL_IP6;
}
- fib_table_entry_special_remove(0, &pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove(0, &pfx, lb_fib_src);
}
int lb_vip_add(lb_vip_add_args_t args, u32 *vip_index)
@@ -1445,6 +1448,11 @@ lb_init (vlib_main_t * vm)
#define _(a,b,c) lbm->vip_counters[c].name = b;
lb_foreach_vip_counter
#undef _
+
+ lb_fib_src = fib_source_allocate("lb",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
+
return NULL;
}
diff --git a/src/plugins/nat/dslite.c b/src/plugins/nat/dslite.c
index 339c12c5656..d9a17293fac 100644
--- a/src/plugins/nat/dslite.c
+++ b/src/plugins/nat/dslite.c
@@ -109,7 +109,7 @@ dslite_set_aftr_ip6_addr (dslite_main_t * dm, ip6_address_t * addr)
.fp_len = 0,
.fp_addr.ip4.as_u32 = 0,
};
- fib_table_entry_special_dpo_add (0, &pfx, FIB_SOURCE_PLUGIN_HI,
+ fib_table_entry_special_dpo_add (0, &pfx, nat_fib_src_hi,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
}
else
@@ -121,7 +121,7 @@ dslite_set_aftr_ip6_addr (dslite_main_t * dm, ip6_address_t * addr)
.fp_addr.ip6.as_u64[0] = addr->as_u64[0],
.fp_addr.ip6.as_u64[1] = addr->as_u64[1],
};
- fib_table_entry_special_dpo_add (0, &pfx, FIB_SOURCE_PLUGIN_HI,
+ fib_table_entry_special_dpo_add (0, &pfx, nat_fib_src_hi,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
}
@@ -153,7 +153,7 @@ dslite_set_b4_ip6_addr (dslite_main_t * dm, ip6_address_t * addr)
.fp_addr.ip6.as_u64[0] = addr->as_u64[0],
.fp_addr.ip6.as_u64[1] = addr->as_u64[1],
};
- fib_table_entry_special_dpo_add (0, &pfx, FIB_SOURCE_PLUGIN_HI,
+ fib_table_entry_special_dpo_add (0, &pfx, nat_fib_src_hi,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
dpo_reset (&dpo);
@@ -218,7 +218,7 @@ dslite_add_del_pool_addr (dslite_main_t * dm, ip4_address_t * addr, u8 is_add)
foreach_snat_protocol
#undef _
dslite_dpo_create (DPO_PROTO_IP4, 0, &dpo_v4);
- fib_table_entry_special_dpo_add (0, &pfx, FIB_SOURCE_PLUGIN_HI,
+ fib_table_entry_special_dpo_add (0, &pfx, nat_fib_src_hi,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo_v4);
dpo_reset (&dpo_v4);
}
@@ -231,7 +231,7 @@ dslite_add_del_pool_addr (dslite_main_t * dm, ip4_address_t * addr, u8 is_add)
vec_free (a->busy_##n##_ports_per_thread);
foreach_snat_protocol
#undef _
- fib_table_entry_special_remove (0, &pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove (0, &pfx, nat_fib_src_hi);
vec_del1 (dm->addr_pool, i);
}
return 0;
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 0a30caf0f21..d7133684b32 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -38,6 +38,9 @@
snat_main_t snat_main;
+fib_source_t nat_fib_src_hi;
+fib_source_t nat_fib_src_low;
+
/* *INDENT-OFF* */
/* Hook up input features */
VNET_FEATURE_INIT (nat_pre_in2out, static) = {
@@ -536,7 +539,7 @@ snat_add_del_addr_to_fib (ip4_address_t * addr, u8 p_len, u32 sw_if_index,
if (is_add)
fib_table_entry_update_one_path (fib_index,
&prefix,
- FIB_SOURCE_PLUGIN_LOW,
+ nat_fib_src_low,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_LOCAL |
FIB_ENTRY_FLAG_EXCLUSIVE),
@@ -545,7 +548,7 @@ snat_add_del_addr_to_fib (ip4_address_t * addr, u8 p_len, u32 sw_if_index,
sw_if_index,
~0, 1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
else
- fib_table_entry_delete (fib_index, &prefix, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_delete (fib_index, &prefix, nat_fib_src_low);
}
int
@@ -577,7 +580,7 @@ snat_add_address (snat_main_t * sm, ip4_address_t * addr, u32 vrf_id,
if (vrf_id != ~0)
ap->fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, vrf_id,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
else
ap->fib_index = ~0;
#define _(N, i, n, s) \
@@ -813,7 +816,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
local->vrf_id = vrf_id;
local->fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, vrf_id,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
m_key.addr = m->local_addr;
m_key.port = m->local_port;
m_key.protocol = m->proto;
@@ -834,13 +837,13 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
if (vrf_id != ~0)
fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, vrf_id,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
/* If not specified use inside VRF id from SNAT plugin startup config */
else
{
fib_index = sm->inside_fib_index;
vrf_id = sm->inside_vrf_id;
- fib_table_lock (fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_lock (fib_index, FIB_PROTOCOL_IP4, nat_fib_src_low);
}
if (!(out2in_only || identity_nat))
@@ -1133,7 +1136,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
}
}
- fib_table_unlock (fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_unlock (fib_index, FIB_PROTOCOL_IP4, nat_fib_src_low);
if (pool_elts (m->locals))
return 0;
@@ -1291,7 +1294,7 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
locals[i].fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
locals[i].vrf_id,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
m_key.addr = locals[i].addr;
m_key.fib_index = locals[i].fib_index;
if (!out2in_only)
@@ -1381,7 +1384,7 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
pool_foreach (local, m->locals,
({
fib_table_unlock (local->fib_index, FIB_PROTOCOL_IP4,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
m_key.addr = local->addr;
if (!out2in_only)
{
@@ -1514,7 +1517,7 @@ nat44_lb_static_mapping_add_del_local (ip4_address_t e_addr, u16 e_port,
local->vrf_id = vrf_id;
local->fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, vrf_id,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
if (!is_out2in_only_static_mapping (m))
{
@@ -1536,7 +1539,7 @@ nat44_lb_static_mapping_add_del_local (ip4_address_t e_addr, u16 e_port,
return VNET_API_ERROR_UNSPECIFIED;
fib_table_unlock (match_local->fib_index, FIB_PROTOCOL_IP4,
- FIB_SOURCE_PLUGIN_LOW);
+ nat_fib_src_low);
if (!is_out2in_only_static_mapping (m))
{
@@ -1687,7 +1690,7 @@ snat_del_address (snat_main_t * sm, ip4_address_t addr, u8 delete_sm,
}
if (a->fib_index != ~0)
- fib_table_unlock (a->fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_unlock (a->fib_index, FIB_PROTOCOL_IP4, nat_fib_src_low);
/* Delete sessions using address */
if (a->busy_tcp_ports || a->busy_udp_ports || a->busy_icmp_ports)
@@ -2464,6 +2467,13 @@ snat_init (vlib_main_t * vm)
};
vec_add1 (ip4_main.table_bind_callbacks, cbt4);
+ nat_fib_src_hi = fib_source_allocate ("nat-hi",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
+ nat_fib_src_low = fib_source_allocate ("nat-low",
+ FIB_SOURCE_PRIORITY_LOW,
+ FIB_SOURCE_BH_SIMPLE);
+
/* Init virtual fragmenentation reassembly */
return nat_reass_init (vm);
}
@@ -2915,13 +2925,13 @@ nat44_add_del_address_dpo (ip4_address_t addr, u8 is_add)
if (is_add)
{
nat_dpo_create (DPO_PROTO_IP4, 0, &dpo_v4);
- fib_table_entry_special_dpo_add (0, &pfx, FIB_SOURCE_PLUGIN_HI,
+ fib_table_entry_special_dpo_add (0, &pfx, nat_fib_src_hi,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo_v4);
dpo_reset (&dpo_v4);
}
else
{
- fib_table_entry_special_remove (0, &pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove (0, &pfx, nat_fib_src_hi);
}
}
@@ -3836,15 +3846,15 @@ snat_config (vlib_main_t * vm, unformat_input_t * input)
sm->outside_vrf_id = outside_vrf_id;
sm->outside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
outside_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
nm->outside_vrf_id = outside_ip6_vrf_id;
nm->outside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
outside_ip6_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
sm->inside_vrf_id = inside_vrf_id;
sm->inside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
inside_vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
sm->static_mapping_only = static_mapping_only;
sm->static_mapping_connection_tracking = static_mapping_connection_tracking;
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index b65ad1b676f..ee712f4748f 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -23,6 +23,7 @@
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/icmp46_packet.h>
#include <vnet/api_errno.h>
+#include <vnet/fib/fib_source.h>
#include <vppinfra/elog.h>
#include <vppinfra/bihash_8_8.h>
#include <vppinfra/bihash_16_8.h>
@@ -742,6 +743,9 @@ extern vlib_node_registration_t nat44_ed_in2out_worker_handoff_node;
extern vlib_node_registration_t nat44_ed_in2out_output_worker_handoff_node;
extern vlib_node_registration_t nat44_ed_out2in_worker_handoff_node;
+extern fib_source_t nat_fib_src_hi;
+extern fib_source_t nat_fib_src_low;
+
/* format functions */
format_function_t format_snat_user;
format_function_t format_snat_static_mapping;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 0fe29800420..e1afea6510e 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -343,7 +343,7 @@ nat64_add_del_pool_addr (u32 thread_index,
if (vrf_id != ~0)
a->fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
#define _(N, id, n, s) \
clib_bitmap_alloc (a->busy_##n##_port_bitmap, 65535); \
a->busy_##n##_ports = 0; \
@@ -357,8 +357,7 @@ nat64_add_del_pool_addr (u32 thread_index,
return VNET_API_ERROR_NO_SUCH_ENTRY;
if (a->fib_index != ~0)
- fib_table_unlock (a->fib_index, FIB_PROTOCOL_IP6,
- FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (a->fib_index, FIB_PROTOCOL_IP6, nat_fib_src_hi);
/* Delete sessions using address */
/* *INDENT-OFF* */
vec_foreach (db, nm->db)
@@ -688,7 +687,7 @@ nat64_add_del_static_bib_entry (ip6_address_t * in_addr,
nat64_main_t *nm = &nat64_main;
nat64_db_bib_entry_t *bibe;
u32 fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
snat_protocol_t p = ip_proto_to_snat_proto (proto);
ip46_address_t addr;
int i;
@@ -1027,7 +1026,7 @@ nat64_add_del_prefix (ip6_address_t * prefix, u8 plen, u32 vrf_id, u8 is_add)
vec_add2 (nm->pref64, p, 1);
p->fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
p->vrf_id = vrf_id;
}
diff --git a/src/plugins/nat/nat64_cli.c b/src/plugins/nat/nat64_cli.c
index 53152f11996..be468df1753 100644
--- a/src/plugins/nat/nat64_cli.c
+++ b/src/plugins/nat/nat64_cli.c
@@ -633,9 +633,9 @@ nat64_add_del_prefix_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
fib_index =
fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
- vrf_id, FIB_SOURCE_PLUGIN_HI);
+ vrf_id, nat_fib_src_hi);
fib_table_entry_update_one_path (fib_index, &fibpfx,
- FIB_SOURCE_PLUGIN_HI,
+ nat_fib_src_hi,
FIB_ENTRY_FLAG_NONE,
DPO_PROTO_IP6, NULL,
sw_if_index, ~0, 0,
@@ -645,12 +645,11 @@ nat64_add_del_prefix_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
fib_index = fib_table_find (FIB_PROTOCOL_IP6, vrf_id);
fib_table_entry_path_remove (fib_index, &fibpfx,
- FIB_SOURCE_PLUGIN_HI,
+ nat_fib_src_hi,
DPO_PROTO_IP6, NULL,
sw_if_index, ~0, 1,
FIB_ROUTE_PATH_INTF_RX);
- fib_table_unlock (fib_index, FIB_PROTOCOL_IP6,
- FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, FIB_PROTOCOL_IP6, nat_fib_src_hi);
}
}
diff --git a/src/plugins/nat/nat66.c b/src/plugins/nat/nat66.c
index 2caefab6480..e5e783b31f7 100644
--- a/src/plugins/nat/nat66.c
+++ b/src/plugins/nat/nat66.c
@@ -170,7 +170,7 @@ nat66_static_mapping_add_del (ip6_address_t * l_addr, ip6_address_t * e_addr,
return VNET_API_ERROR_VALUE_EXIST;
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
- FIB_SOURCE_PLUGIN_HI);
+ nat_fib_src_hi);
pool_get (nm->sm, sm);
clib_memset (sm, 0, sizeof (*sm));
sm->l_addr.as_u64[0] = l_addr->as_u64[0];
@@ -214,8 +214,7 @@ nat66_static_mapping_add_del (ip6_address_t * l_addr, ip6_address_t * e_addr,
kv.key[2] = sm_key.as_u64[2];
if (clib_bihash_add_del_24_8 (&nm->sm_e, &kv, 0))
nat_elog_warn ("nat66-static-map-by-external delete key failed");
- fib_table_unlock (sm->fib_index, FIB_PROTOCOL_IP6,
- FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (sm->fib_index, FIB_PROTOCOL_IP6, nat_fib_src_hi);
pool_put (nm->sm, sm);
}
diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c
index 2d63b3e8674..1f8a7288aeb 100644
--- a/src/plugins/pppoe/pppoe.c
+++ b/src/plugins/pppoe/pppoe.c
@@ -37,6 +37,8 @@
pppoe_main_t pppoe_main;
+static fib_source_t pppoe_fib_src;
+
u8 *
format_pppoe_session (u8 * s, va_list * args)
{
@@ -376,7 +378,7 @@ int vnet_pppoe_add_del_session
/* add reverse route for client ip */
fib_table_entry_path_add (a->decap_fib_index, &pfx,
- FIB_SOURCE_PLUGIN_HI, FIB_ENTRY_FLAG_NONE,
+ pppoe_fib_src, FIB_ENTRY_FLAG_NONE,
fib_proto_to_dpo (pfx.fp_proto),
&pfx.fp_addr, sw_if_index, ~0,
1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
@@ -408,7 +410,7 @@ int vnet_pppoe_add_del_session
/* delete reverse route for client ip */
fib_table_entry_path_remove (a->decap_fib_index, &pfx,
- FIB_SOURCE_PLUGIN_HI,
+ pppoe_fib_src,
fib_proto_to_dpo (pfx.fp_proto),
&pfx.fp_addr,
sw_if_index, ~0, 1,
@@ -721,6 +723,10 @@ pppoe_init (vlib_main_t * vm)
ethernet_register_input_type (vm, ETHERNET_TYPE_PPPOE_DISCOVERY,
pppoe_cp_dispatch_node.index);
+ pppoe_fib_src = fib_source_allocate ("pppoe",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_API);
+
return 0;
}
diff --git a/src/plugins/svs/svs.c b/src/plugins/svs/svs.c
index 8c1487c6ebc..555283397ff 100644
--- a/src/plugins/svs/svs.c
+++ b/src/plugins/svs/svs.c
@@ -26,10 +26,12 @@
u32 *svs_itf_db[FIB_PROTOCOL_IP_MAX];
+static fib_source_t svs_fib_src;
+
int
svs_table_add (fib_protocol_t fproto, u32 table_id)
{
- fib_table_find_or_create_and_lock (fproto, table_id, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_find_or_create_and_lock (fproto, table_id, svs_fib_src);
return (0);
}
@@ -50,7 +52,7 @@ svs_table_delete (fib_protocol_t fproto, u32 table_id)
if (~0 == fib_index)
return VNET_API_ERROR_NO_SUCH_FIB;
- fib_table_unlock (fib_index, fproto, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_unlock (fib_index, fproto, svs_fib_src);
return (0);
}
@@ -68,7 +70,7 @@ svs_route_add_i (u32 fib_index, const fib_prefix_t * pfx, u32 src_fib_index)
LOOKUP_TABLE_FROM_CONFIG, &dpo);
fib_table_entry_special_dpo_add (fib_index, pfx,
- FIB_SOURCE_PLUGIN_LOW,
+ svs_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
dpo_unlock (&dpo);
@@ -107,7 +109,7 @@ svs_route_delete (u32 table_id, const fib_prefix_t * pfx)
if (~0 == fib_index)
return VNET_API_ERROR_NO_SUCH_FIB;
- fib_table_entry_special_remove (fib_index, pfx, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_special_remove (fib_index, pfx, svs_fib_src);
return (0);
}
@@ -214,7 +216,7 @@ svs_disable (fib_protocol_t fproto, u32 table_id, u32 sw_if_index)
"svs-ip4" :
"svs-ip6"), sw_if_index, 0, NULL, 0);
- fib_table_entry_special_remove (fib_index, &pfx, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_special_remove (fib_index, &pfx, svs_fib_src);
return (0);
}
@@ -607,6 +609,10 @@ svs_init (vlib_main_t * vm)
};
vec_add1 (ip4_main.table_bind_callbacks, cbt4);
+ svs_fib_src = fib_source_allocate ("svs",
+ FIB_SOURCE_PRIORITY_LOW,
+ FIB_SOURCE_BH_SIMPLE);
+
return (NULL);
}
diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c
index f220eb0d358..2d75f28a8ca 100644
--- a/src/plugins/unittest/fib_test.c
+++ b/src/plugins/unittest/fib_test.c
@@ -9310,13 +9310,16 @@ fib_test_inherit (void)
"%U via 10.10.10.2",
format_fib_prefix, &pfx_10_10_10_0_s_24);
+ fib_source_t hi_src = fib_source_allocate("test", 0x50,
+ FIB_SOURCE_BH_SIMPLE);
+
/*
* add the source that replaces inherited state.
* inheriting source is not the best, so it doesn't push state.
*/
fib_table_entry_update_one_path(0,
&pfx_10_10_10_0_s_24,
- FIB_SOURCE_PLUGIN_HI,
+ hi_src,
FIB_ENTRY_FLAG_NONE,
DPO_PROTO_IP4,
&nh_10_10_10_1,
@@ -9354,7 +9357,7 @@ fib_test_inherit (void)
* withdraw the higher priority source and expect the inherited to return
* throughout the sub-tree
*/
- fib_table_entry_delete(0, &pfx_10_10_10_0_s_24, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_delete(0, &pfx_10_10_10_0_s_24, hi_src);
fei = fib_table_lookup_exact_match(0, &pfx_10_10_10_21_s_32);
FIB_TEST(!fib_test_validate_entry(fei,