From 7801ca29b8f1b3a7b2ff68f3f84a0ae02a58b563 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Thu, 3 Aug 2017 00:58:05 -0700 Subject: SNAT: fix address and port allocation for multiple worker threads (VPP-925) There is a chance to allocate the same outside address and port. Assign a block of port numbers to each worker. Change-Id: I6ef7dc0aab4834705f4e6097c362940d18d747e8 Signed-off-by: Matus Fabian --- src/plugins/snat/in2out.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/snat/in2out.c') diff --git a/src/plugins/snat/in2out.c b/src/plugins/snat/in2out.c index eb5b9da5dc7..abe0d9dbe87 100644 --- a/src/plugins/snat/in2out.c +++ b/src/plugins/snat/in2out.c @@ -356,8 +356,8 @@ static u32 slow_path (snat_main_t *sm, vlib_buffer_t *b0, } s->outside_address_index = ~0; - if (snat_alloc_outside_address_and_port (sm, rx_fib_index0, &key1, - &address_index)) + if (snat_alloc_outside_address_and_port (sm, rx_fib_index0, thread_index, + &key1, &address_index)) { ASSERT(0); @@ -375,7 +375,8 @@ static u32 slow_path (snat_main_t *sm, vlib_buffer_t *b0, { static_mapping = 0; /* Try to create dynamic translation */ - if (snat_alloc_outside_address_and_port (sm, rx_fib_index0, &key1, + if (snat_alloc_outside_address_and_port (sm, rx_fib_index0, + thread_index, &key1, &address_index)) { b0->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS]; -- cgit 1.2.3-korg