summaryrefslogtreecommitdiffstats
path: root/plugins/snat-plugin/snat/snat.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/snat-plugin/snat/snat.c')
-rw-r--r--plugins/snat-plugin/snat/snat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/snat-plugin/snat/snat.c b/plugins/snat-plugin/snat/snat.c
index 70df44ea1d4..02077c329f0 100644
--- a/plugins/snat-plugin/snat/snat.c
+++ b/plugins/snat-plugin/snat/snat.c
@@ -494,8 +494,10 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr,
if (!clib_bihash_search_8_8 (&sm->user_hash, &kv, &value))
{
user_index = value.value;
- clib_bihash_search_8_8 (&sm->worker_by_in, &kv, &value);
- tsm = vec_elt_at_index (sm->per_thread_data, value.value);
+ if (!clib_bihash_search_8_8 (&sm->worker_by_in, &kv, &value))
+ tsm = vec_elt_at_index (sm->per_thread_data, value.value);
+ else
+ tsm = vec_elt_at_index (sm->per_thread_data, sm->num_workers);
u = pool_elt_at_index (tsm->users, user_index);
if (u->nstaticsessions)
{