aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/nat64.c')
-rw-r--r--src/plugins/nat/nat64.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index e60d9ec0219..571e0717826 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -202,7 +202,7 @@ nat64_get_worker_out2in (ip4_header_t * ip)
/* worker by outside port (TCP/UDP) */
port = clib_net_to_host_u16 (port);
if (port > 1024)
- return (u32) ((port - 1024) / sm->port_per_thread);
+ return nm->sm->first_worker_index + ((port - 1024) / sm->port_per_thread);
return vlib_get_thread_index ();
}
@@ -497,13 +497,17 @@ nat64_alloc_out_addr_and_port (u32 fib_index, snat_protocol_t proto,
snat_main_t *sm = nm->sm;
snat_session_key_t k;
u32 ai;
+ u32 worker_index = 0;
int rv;
k.protocol = proto;
+ if (sm->num_workers > 1)
+ worker_index = thread_index - sm->first_worker_index;
+
rv =
sm->alloc_addr_and_port (nm->addr_pool, fib_index, thread_index, &k, &ai,
- sm->port_per_thread, thread_index);
+ sm->port_per_thread, worker_index);
if (!rv)
{