session/udp: init rw locks
Change-Id: I68152d7338ce0d7805e50ccf9e9046de02cfd206
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index c12e837..7009165 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -334,6 +334,7 @@
u32 num_threads;
clib_error_t *error = 0;
ip_protocol_info_t *pi;
+ int i;
if ((error = vlib_call_init_function (vm, ip_main_init)))
return error;
@@ -367,6 +368,13 @@
vec_validate (um->connection_peekers, num_threads - 1);
vec_validate (um->peekers_readers_locks, num_threads - 1);
vec_validate (um->peekers_write_locks, num_threads - 1);
+
+ if (num_threads > 1)
+ for (i = 0; i < num_threads; i++)
+ {
+ clib_spinlock_init (&um->peekers_readers_locks[i]);
+ clib_spinlock_init (&um->peekers_write_locks[i]);
+ }
return error;
}