summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/out2in.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/snat/out2in.c')
-rw-r--r--src/plugins/snat/out2in.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/snat/out2in.c b/src/plugins/snat/out2in.c
index f1329733ecf..855e9efb806 100644
--- a/src/plugins/snat/out2in.c
+++ b/src/plugins/snat/out2in.c
@@ -901,8 +901,12 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm,
if (clib_bihash_search_8_8 (&sm->worker_by_out, &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)];
+ }
}
else
{