aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-07-23 23:41:03 -0700
committerNeale Ranns <nranns@cisco.com>2017-07-25 09:11:06 +0000
commitf8d84901e4f82c54545030a881da9aded659baf9 (patch)
tree94ec79da462778337007b4562219c0fa417c166a
parent50b81e07036afa68c9bf7b457ebc733b3e694976 (diff)
SANT: fib_table unlock (VPP-918)
Change-Id: Ie0ad3671e3f4b55cd0f14601b6fed9ee2a1cbec0 Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r--src/plugins/snat/nat64.c3
-rw-r--r--src/plugins/snat/snat.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/snat/nat64.c b/src/plugins/snat/nat64.c
index d7772a74d36..47809b05d09 100644
--- a/src/plugins/snat/nat64.c
+++ b/src/plugins/snat/nat64.c
@@ -118,6 +118,9 @@ nat64_add_del_pool_addr (ip4_address_t * addr, u32 vrf_id, u8 is_add)
if (!a)
return VNET_API_ERROR_NO_SUCH_ENTRY;
+ if (a->fib_index)
+ fib_table_unlock (a->fib_index, FIB_PROTOCOL_IP6);
+
#define _(N, id, n, s) \
clib_bitmap_free (a->busy_##n##_port_bitmap);
foreach_snat_protocol
diff --git a/src/plugins/snat/snat.c b/src/plugins/snat/snat.c
index 1820aef8829..f927915ca6d 100644
--- a/src/plugins/snat/snat.c
+++ b/src/plugins/snat/snat.c
@@ -165,7 +165,11 @@ void snat_add_address (snat_main_t *sm, ip4_address_t *addr, u32 vrf_id)
vec_add2 (sm->addresses, ap, 1);
ap->addr = *addr;
- ap->fib_index = ip4_fib_index_from_table_id(vrf_id);
+ if (vrf_id != ~0)
+ ap->fib_index =
+ fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, vrf_id);
+ else
+ ap->fib_index = ~0;
#define _(N, i, n, s) \
clib_bitmap_alloc (ap->busy_##n##_port_bitmap, 65535);
foreach_snat_protocol
@@ -631,6 +635,9 @@ int 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);
+
/* Delete sessions using address */
if (a->busy_tcp_ports || a->busy_udp_ports || a->busy_icmp_ports)
{