]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #5068: ips_options: reset PCRE rule counts on new configuration loaded
authorViktor Chyzhovych -X (vchyzhov - SOFTSERVE INC at Cisco) <vchyzhov@cisco.com>
Wed, 7 Jan 2026 08:55:03 +0000 (08:55 +0000)
committerOleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Wed, 7 Jan 2026 08:55:03 +0000 (08:55 +0000)
Merge in SNORT/snort3 from ~VCHYZHOV/snort3:fix_pcre_rule_counts to master

Squashed commit of the following:

commit 00454f429eca1af4d67d1ef6e4981d1d8814f30d
Author: Viktor Chyzhovych <vchyzhov@cisco.com>
Date:   Wed Dec 17 14:57:28 2025 +0200

    ips_options: reset PCRE rule counts on new configuration loaded

src/ips_options/ips_pcre.cc

index eb775ae3af2ed9210e8eb6fdcec603123e972a84..e923b8b974def42406c0422608b61ff0cd236fbf 100644 (file)
@@ -110,6 +110,7 @@ struct PcreCounts
 };
 
 PcreCounts pcre_counts;
+static const SnortConfig* pcre_counts_config_generation = nullptr;
 
 void show_pcre_counts()
 {
@@ -696,6 +697,13 @@ bool PcreModule::begin(const char* name, int v, SnortConfig* sc)
 
 bool PcreModule::set(const char* name, Value& v, SnortConfig* sc)
 {
+    // Reset PCRE counters once per new configuration build
+    if (sc != pcre_counts_config_generation)
+    {
+        pcre_counts = {};
+        pcre_counts_config_generation = sc;
+    }
+
     assert(v.is("~re"));
     re = v.get_string();