mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Introduce ZEEK_SEED_VALUES environment variable
For "individually different but deterministic" runs specifying Zeek's seed as an environment variable eases setups as one can avoid creating extra seed files for each of the individual processes. It is an error to specify the new ZEEK_SEED_VALUES variable together with the existing ZEEK_SEED_FILE and -G. ZEEK_SEED takes precedence over deterministic mode (-D) like ZEEK_SEED_FILE does today already.
This commit is contained in:
parent
b98ae9bdb2
commit
b2d934226f
9 changed files with 134 additions and 8 deletions
|
@ -629,15 +629,22 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
supervisor_mgr = new Supervisor(std::move(cfg), std::move(*stem));
|
||||
}
|
||||
|
||||
std::string seed_string;
|
||||
if ( const auto* seed_env = getenv("ZEEK_SEED_VALUES") )
|
||||
seed_string = seed_env;
|
||||
|
||||
const char* seed_load_file = getenv("ZEEK_SEED_FILE");
|
||||
|
||||
if ( options.random_seed_input_file )
|
||||
seed_load_file = options.random_seed_input_file->data();
|
||||
|
||||
if ( seed_load_file && *seed_load_file && ! seed_string.empty() )
|
||||
reporter->FatalError("can't use ZEEK_SEED_VALUES together with ZEEK_SEED_FILE or -G");
|
||||
|
||||
util::detail::init_random_seed(
|
||||
(seed_load_file && *seed_load_file ? seed_load_file : nullptr),
|
||||
options.random_seed_output_file ? options.random_seed_output_file->data() : nullptr,
|
||||
options.deterministic_mode);
|
||||
options.deterministic_mode, seed_string);
|
||||
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key));
|
||||
init_hash_function();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue