Merge in SNORT/snort3 from ~ANOROKH/snort3:trs_alerts_dup_fix to master
Squashed commit of the following:
commit
08cecc25c6ca5763c725ccfb0fe48e692f0cfee7
Author: Anna Norokh <anorokh@cisco.com>
Date: Fri Sep 29 13:42:35 2023 +0300
stream: skip duplicated alerts in TcpReassemblerState's list
* add assert() to verify flow.trs_alerts test work
Thanks wenhao-in-chengdu for reporting the issue and suggesting a fix.
bool TcpReassembler::add_alert(TcpReassemblerState& trs, uint32_t gid, uint32_t sid)
{
- trs.alerts.emplace_back(gid, sid);
+ assert(trs.alerts.size() <=
+ (uint32_t)(get_ips_policy()->rules_loaded + get_ips_policy()->rules_shared));
+
+ if (!this->check_alerted(trs, gid, sid))
+ trs.alerts.emplace_back(gid, sid);
+
return true;
}