mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Better initialization of random generator
Use full time precision to initialize random generator. The old code was prone to initialize it to the same values in specific circumstances (boot without RTC, multiple VMs starting at once).
This commit is contained in:
parent
70fab17837
commit
eaf63d314d
@ -2144,7 +2144,9 @@ io_init(void)
|
||||
// XXX init_times();
|
||||
// XXX update_times();
|
||||
boot_time = current_time();
|
||||
srandom((uint) (current_real_time() TO_S));
|
||||
|
||||
u64 now = (u64) current_real_time();
|
||||
srandom((uint) (now ^ (now >> 32)));
|
||||
}
|
||||
|
||||
static int short_loops = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user