Merge in SNORT/snort3 from ~RUCOMBS/snort3:tsanity1 to master
Squashed commit of the following:
commit
ddec702eca36358fe5238fa2cee3664bc20d0f9d
Author: Russ Combs <rucombs@cisco.com>
Date: Thu Dec 19 09:47:37 2024 -0500
data_bus: fix publisher registration data races
commit
da6d5590d82cd4d123029f00e4b18d4de46bf72d
Author: Russ Combs <rucombs@cisco.com>
Date: Thu Dec 19 07:42:03 2024 -0500
hyperscan: fix debug log tsan issue
void print_option_tree(detection_option_tree_node_t* node, int level)
{
#ifdef DEBUG_MSGS
+ if ( !trace_enabled(detection_trace, TRACE_OPTION_TREE) )
+ return;
+
char buf[32];
const char* opt;
DataBus::subscribe_global(intrinsic_pub_key, IntrinsicEventIds::FLOW_NO_SERVICE,
new AppIdServiceEventHandler(*this), *sc);
- cached_global_pub_id = DataBus::get_id(appid_pub_key);
+ if (!cached_global_pub_id)
+ cached_global_pub_id = DataBus::get_id(appid_pub_key);
+
appid_pub_id = cached_global_pub_id;
return true;
}
DataBus::subscribe_network(intrinsic_pub_key, IntrinsicEventIds::AUXILIARY_IP, new AuxiliaryIpRepHandler(*this));
DataBus::subscribe_network(intrinsic_pub_key, IntrinsicEventIds::PKT_WITHOUT_FLOW, new IpRepHandler(*this));
- pub_id = DataBus::get_id(reputation_pub_key);
+ if (!pub_id)
+ pub_id = DataBus::get_id(reputation_pub_key);
+
return true;
}
bool RnaInspector::configure(SnortConfig*)
{
- RnaConfig::pub_id = DataBus::get_id(rna_pub_key);
+ if (!RnaConfig::pub_id)
+ RnaConfig::pub_id = DataBus::get_id(rna_pub_key);
DataBus::subscribe_network( appid_pub_key, AppIdEventIds::ANY_CHANGE, new RnaAppidEventHandler(*pnd) );
DataBus::subscribe_network( appid_pub_key, AppIdEventIds::DHCP_INFO, new RnaDHCPInfoEventHandler(*pnd) );
};
Cip::Cip(CipProtoConf* pc)
-{
- config = pc;
-}
+{ config = pc; }
Cip::~Cip()
-{
- if (config)
- {
- delete config;
- }
-}
+{ delete config; }
bool Cip::configure(SnortConfig*)
{
- CipEventData::pub_id = DataBus::get_id(cip_pub_key);
+ if (!CipEventData::pub_id)
+ CipEventData::pub_id = DataBus::get_id(cip_pub_key);
+
return true;
}
bool Dce2Tcp::configure(snort::SnortConfig* sc)
{
esm.set_proto_id(sc->proto_ref->add(DCE_RPC_SERVICE_NAME));
- pub_id = DataBus::get_id(dce_tcp_pub_key);
+
+ if (!pub_id)
+ pub_id = DataBus::get_id(dce_tcp_pub_key);
+
return true;
}
bool Dns::configure(snort::SnortConfig*)
{
- pub_id = DataBus::get_id(dns_pub_key);
+ if ( !pub_id )
+ pub_id = DataBus::get_id(dns_pub_key);
+
return true;
}
bool FtpServer::configure(SnortConfig* sc)
{
- pub_id = DataBus::get_id(ftp_pub_key);
+ if ( !pub_id )
+ pub_id = DataBus::get_id(ftp_pub_key);
+
ftp_data_snort_protocol_id = sc->proto_ref->add("ftp-data");
return !FTPCheckConfigs(sc, ftp_server);
}
{
params->js_norm_param.configure();
params->mime_decode_conf->sync_all_depths(sc);
- pub_id = DataBus::get_id(http_pub_key);
+
+ if (!pub_id)
+ pub_id = DataBus::get_id(http_pub_key);
return true;
}
bool NetFlowInspector::configure(SnortConfig*)
{
- pub_id = DataBus::get_id(netflow_pub_key);
+ if ( !pub_id )
+ pub_id = DataBus::get_id(netflow_pub_key);
+
return true;
}
bool Sip::configure(SnortConfig*)
{
- SIPData::pub_id = DataBus::get_id(sip_pub_key);
+ if ( !SIPData::pub_id )
+ SIPData::pub_id = DataBus::get_id(sip_pub_key);
+
return true;
}
bool Ssh::configure(SnortConfig*)
{
- pub_id = DataBus::get_id(ssh_pub_key);
+ if ( !pub_id )
+ pub_id = DataBus::get_id(ssh_pub_key);
+
return true;
}
bool Ssl::configure(SnortConfig*)
{
- pub_id = DataBus::get_id(ssl_pub_key);
+ if ( !pub_id )
+ pub_id = DataBus::get_id(ssl_pub_key);
DataBus::subscribe(intrinsic_pub_key, IntrinsicEventIds::FINALIZE_PACKET, new SslFinalizePacketHandler());
DataBus::subscribe(intrinsic_pub_key, IntrinsicEventIds::OPPORTUNISTIC_TLS, new SslStartTlsEventtHandler());
static unsigned stream_pub_id = 0;
void Stream::set_pub_id()
-{ stream_pub_id = DataBus::get_id(stream_pub_key); }
+{
+ if ( !stream_pub_id )
+ stream_pub_id = DataBus::get_id(stream_pub_key);
+}
unsigned Stream::get_pub_id()
{ return stream_pub_id; }