Merge in SNORT/snort3 from ~RSHAFIQ/snort3:rand_dev_exception to master
Squashed commit of the following:
commit
3cf896071f6c739cd5d36038c99eae8f928e2e66
Author: rshafiq <rshafiq@cisco.com>
Date: Wed Mar 13 13:40:21 2024 -0400
hash: exception handling for random device
void trace_vprintf(const char*, TraceLevel, const char*, const Packet*, const char*, va_list) {}
+unsigned get_instance_id() { return 0; }
+
namespace ip
{
uint32_t IpApi::id() const { return 0; }
{
return 1;
}
+unsigned int get_random_seed()
+{ return 3193; }
TEST_GROUP(flow_prune) { };
HashKeyOperations::HashKeyOperations(int rows)
{
- static std::mt19937 generator(static_cast<unsigned int>(std::random_device{}()));
-
if (SnortConfig::static_hash())
{
seed = 3193;
rows = 1;
std::uniform_int_distribution<> distr(1, rows);
+ static auto gen_seed = get_random_seed();
+ static thread_local std::mt19937 generator(gen_seed + get_instance_id());
seed = nearest_prime(distr(generator) + 3191);
scale = nearest_prime(distr(generator) + 709);
static SnortConfig my_config;
THREAD_LOCAL SnortConfig* snort_conf = &my_config;
+unsigned snort::get_instance_id() { return 0; }
+
DataBus::DataBus() = default;
DataBus::~DataBus() = default;
const SnortConfig* SnortConfig::get_conf()
{ return snort_conf; }
+unsigned int get_random_seed()
+{ return 3193; }
+
// user free function
static void myfree(void* p)
{
static SnortConfig my_config;
THREAD_LOCAL SnortConfig* snort_conf = &my_config;
+unsigned snort::get_instance_id() { return 0; }
+
DataBus::DataBus() = default;
DataBus::~DataBus() = default;
const SnortConfig* SnortConfig::get_conf()
{ return snort_conf; }
+unsigned int get_random_seed()
+{ return 3193; }
struct xhash_test_key
{
int key;
else
return false;
}
+
+unsigned get_instance_id() { return 0; }
}
// Stubs whose sole purpose is to make the test code link
const SnortConfig* SnortConfig::get_conf()
{ return snort_conf; }
+unsigned int get_random_seed()
+{ return 3193; }
+
const unsigned ZHASH_ROWS = 50;
const unsigned ZHASH_KEY_SIZE = 100;
const unsigned MAX_ZHASH_NODES = 100;
SFDAQInstance* SFDAQ::get_local_instance() { return nullptr; }
+unsigned int get_random_seed()
+{ return 3193; }
unsigned DataBus::get_id(const PubKey&)
{ return 0; }
}