diff options
Diffstat (limited to 'plugins/snat-plugin/snat')
-rw-r--r-- | plugins/snat-plugin/snat/in2out.c | 2 | ||||
-rw-r--r-- | plugins/snat-plugin/snat/out2in.c | 4 | ||||
-rw-r--r-- | plugins/snat-plugin/snat/snat.c | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/plugins/snat-plugin/snat/in2out.c b/plugins/snat-plugin/snat/in2out.c index e1edbb81581..43ee2d0e75a 100644 --- a/plugins/snat-plugin/snat/in2out.c +++ b/plugins/snat-plugin/snat/in2out.c @@ -1047,6 +1047,8 @@ snat_in2out_worker_handoff_fn (vlib_main_t * vm, u32 current_worker_index = ~0; u32 cpu_index = os_get_cpu_number (); + ASSERT (vec_len (sm->workers)); + if (PREDICT_FALSE (handoff_queue_elt_by_worker_index == 0)) { vec_validate (handoff_queue_elt_by_worker_index, tm->n_vlib_mains - 1); diff --git a/plugins/snat-plugin/snat/out2in.c b/plugins/snat-plugin/snat/out2in.c index a4641d3a71e..13e596b9a0d 100644 --- a/plugins/snat-plugin/snat/out2in.c +++ b/plugins/snat-plugin/snat/out2in.c @@ -830,6 +830,8 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm, u32 current_worker_index = ~0; u32 cpu_index = os_get_cpu_number (); + ASSERT (vec_len (sm->workers)); + if (PREDICT_FALSE (handoff_queue_elt_by_worker_index == 0)) { vec_validate (handoff_queue_elt_by_worker_index, tm->n_vlib_mains - 1); @@ -888,6 +890,8 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm, if (PREDICT_FALSE (next_worker_index != cpu_index)) { + do_handoff = 1; + if (next_worker_index != current_worker_index) { if (hf) 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) { |