Merge in SNORT/snort3 from ~VSHPYRKA/snort3:ctrl_connn_dr_fix to master
Squashed commit of the following:
commit
6efb3d5acac88957a17886969ae9145fb21b0222
Author: Volodymyr Shpyrka <vshpyrka@cisco.com>
Date: Mon Mar 31 03:24:58 2025 -0400
control: fix data race in ControlConn touch method
void ControlConn::touch()
{
- touched = time(nullptr);
+ touched.store(time(nullptr), std::memory_order_relaxed);
}
time_t ControlConn::get_touched() const
{
- return touched;
+ return touched.load(std::memory_order_relaxed);
}
void ControlConn::unblock()
#ifndef CONTROL_H
#define CONTROL_H
+#include <atomic>
#include <cstdarg>
#include <ctime>
#include <queue>
int blocked = 0; // a number of commands blocking the channel
bool local = false;
bool removed = false;
- time_t touched;
+ std::atomic<time_t> touched;
static std::vector<std::string> log_exclusion_list;
static unsigned pending_cmds_count; //counter to serialize commands across control connections
using namespace snort;
static constexpr unsigned MAX_CONTROL_FDS = 16;
+#ifndef REG_TEST
static constexpr unsigned MAX_CONTROL_IDLE_TIME = 60;
+#else
+static constexpr unsigned MAX_CONTROL_IDLE_TIME = 5;
+#endif
static int listener = -1;
static socklen_t sock_addr_size = 0;