BIRD 3: worker threads never seed their random state
Hi, Since 93e3ee892 "Replace random() with jrand48()" the random state is thread-local, but it seems to be seeded only in the main thread: random_init_thread() is called from main(), and I do not see it in bird_thread_main(). I checked with BFD local discriminators on 3.4.0, they are the same after every restart: protocol bfd { neighbor 192.0.2.11 local 127.0.0.1 multihop; neighbor 192.0.2.12 local 127.0.0.1 multihop; neighbor 192.0.2.13 local 127.0.0.1 multihop; } birdc show bfd sessions all | grep -E 'Address|Local discriminator' First start: Address: 192.0.2.11 Local discriminator: 1 Address: 192.0.2.12 Local discriminator: 178803790 Address: 192.0.2.13 Local discriminator: 1565954732 After restart: Address: 192.0.2.11 Local discriminator: 1 Address: 192.0.2.12 Local discriminator: 178803790 Address: 192.0.2.13 Local discriminator: 1565954732 Thanks, Taichi
On Thu, Oct 29, 2026 at 07:19:43PM +0900, taichi aoki wrote:
Hi,
Since 93e3ee892 "Replace random() with jrand48()" the random state is thread-local, but it seems to be seeded only in the main thread: random_init_thread() is called from main(), and I do not see it in bird_thread_main().
Hi Thanks, fixed: https://gitlab.nic.cz/labs/bird/-/commit/3e4e50a54cc98d8b1df77eb17a11d7e7d92... (resent-to ml) -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Ondrej Zajicek -
taichi aoki