BUG/MINOR: init: Initialize random seed earlier in the init process
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Mon, 11 Aug 2025 13:55:35 +0000 (15:55 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Aug 2025 06:47:39 +0000 (08:47 +0200)
commit0429f236a3adae23ca173cf11b74ccfd8099168f
treea0bca85a256105f5e6f31ae4645abcdc7b2b8aef
parent3fff6803385f325c6a87d00405978ab7a2b280e6
BUG/MINOR: init: Initialize random seed earlier in the init process

The random seed used in ha_random functions needs to be first
initialized by calling ha_random_boot. This function was called rather
late in the init process, after the init functions (INITCALLS) are
called and after the configuration parsing for instance which means that
any ha_random call in an init function would return 0. This was the case
in 'vars_init' and 'cache_init' which tried to build seeds for specific
hash calculations but ended up not being seeded.

This patch can be backported on all stable branches.

(cherry picked from commit 15ee49e8222be2b34663fac838aa74e62f6c82ea)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit f7fbb55f0dcbbb44f6d20950bc1c0835699c85b6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/haproxy.c