From 571b647825b0402b1b46b4347b1db508b14cdf88 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 28 Dec 2023 18:03:14 +0100 Subject: [PATCH] subsys/net/lib/lwm2m: Change how we seed the random generator Instead of seeding the random generator from the test itself calling into a host API, let's use the entropy generator option to be seeded from /dev/urandom This avoids trouble with the srandom() and time() calls not existing depending on the chosen C library. Signed-off-by: Alberto Escolar Piedras --- tests/net/lib/lwm2m/interop/boards/native_sim.conf | 1 + tests/net/lib/lwm2m/interop/src/lwm2m-client.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/boards/native_sim.conf b/tests/net/lib/lwm2m/interop/boards/native_sim.conf index 2dc86f3d484..99b234c8e66 100644 --- a/tests/net/lib/lwm2m/interop/boards/native_sim.conf +++ b/tests/net/lib/lwm2m/interop/boards/native_sim.conf @@ -6,3 +6,4 @@ CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2" CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME=y CONFIG_NATIVE_UART_0_ON_STDINOUT=y CONFIG_ASAN=y +CONFIG_NATIVE_EXTRA_CMDLINE_ARGS="--seed-random" diff --git a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c index a150f1b41cb..cb4ab22acd2 100644 --- a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c +++ b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c @@ -224,10 +224,6 @@ int main(void) { int ret; -#if defined(CONFIG_BOARD_NATIVE_POSIX) - srandom(time(NULL)); -#endif - ret = lwm2m_setup(); if (ret < 0) { LOG_ERR("Cannot setup LWM2M fields (%d)", ret);