summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/in2out.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/snat/in2out.c')
-rw-r--r--src/plugins/snat/in2out.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/snat/in2out.c b/src/plugins/snat/in2out.c
index 76a6a12cec5..ba752cf0d41 100644
--- a/src/plugins/snat/in2out.c
+++ b/src/plugins/snat/in2out.c
@@ -1232,8 +1232,12 @@ snat_in2out_worker_handoff_fn (vlib_main_t * vm,
if (clib_bihash_search_8_8 (&sm->worker_by_in, &kv0, &value0))
{
/* No, assign next available worker (RR) */
- next_worker_index = sm->first_worker_index +
- sm->workers[sm->next_worker++ % vec_len (sm->workers)];
+ next_worker_index = sm->first_worker_index;
+ if (vec_len (sm->workers))
+ {
+ next_worker_index +=
+ sm->workers[sm->next_worker++ % _vec_len (sm->workers)];
+ }
/* add non-traslated packets worker lookup */
kv0.value = next_worker_index;