aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-04-24 13:21:43 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-04-24 14:54:05 +0000
commit8e58499690a278a598c9ef7abf47b72fafad7e50 (patch)
tree170d04475fe8ca96e21414fbeb6a4166217b31a5 /src/vnet/udp
parent165e4721e4d803b737e245f8b902d0d198045026 (diff)
UDPC: Fix open segfault with multiple workers
Change-Id: Ib4a64f17831e2419f1d6140a6d24649c096bdfa5 Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/udp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 46a26e484ed..138fe578a01 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -344,9 +344,11 @@ int
udpc_connection_open (transport_endpoint_cfg_t * rmt)
{
udp_connection_t *uc;
+ /* Reproduce the logic of udp_open_connection to find the correct thread */
+ u32 thread_index = vlib_num_workers ()? 1 : vlib_get_main ()->thread_index;
u32 uc_index;
uc_index = udp_open_connection (rmt);
- uc = udp_connection_get (uc_index, vlib_get_thread_index ());
+ uc = udp_connection_get (uc_index, thread_index);
uc->is_connected = 1;
return uc_index;
}