]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1146 in SNORT/snort3 from appid_pegcounts_gone_wild to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 19 Mar 2018 16:23:45 +0000 (12:23 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 19 Mar 2018 16:23:45 +0000 (12:23 -0400)
Squashed commit of the following:

commit 177c974fc84fbd32e4119767cdb62400fc6c46ba
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Mar 19 11:26:38 2018 -0400

    appid: Only import dynamic detector pegcounts once

src/network_inspectors/appid/appid_peg_counts.cc
src/network_inspectors/appid/appid_peg_counts.h

index 5eabe5bc1541cf3f3f729d8295ad7452e3206efd..cadeef48b3cf99394e3c7061d8ba5e1ecc6f82c3 100644 (file)
@@ -30,6 +30,7 @@
 #include <string>
 
 bool AppIdPegCounts::detectors_configured = false;
+bool AppIdPegCounts::dynamic_counts_imported = false;
 uint32_t AppIdPegCounts::unknown_app_idx = 0;
 std::map<AppId, uint32_t> AppIdPegCounts::appid_detector_pegs_idx;
 std::vector<PegInfo> AppIdPegCounts::appid_detectors_peg_info;
@@ -101,10 +102,13 @@ PegInfo* AppIdPegCounts::get_peg_info()
 {
     if ( AppIdPegCounts::detectors_configured )
     {
-        appid_pegs.insert( appid_pegs.end(), appid_detectors_peg_info.begin(), appid_detectors_peg_info.end());
-
-        // add the sentinel entry at the end
-        appid_pegs.push_back({ CountType::END, nullptr, nullptr });
+        if ( !AppIdPegCounts::dynamic_counts_imported )
+        {
+            appid_pegs.insert( appid_pegs.end(), appid_detectors_peg_info.begin(), appid_detectors_peg_info.end());
+            // add the sentinel entry at the end
+            appid_pegs.push_back({ CountType::END, nullptr, nullptr });
+            AppIdPegCounts::dynamic_counts_imported = true;
+        }
         return appid_pegs.data();
     }
     else
index d35cae258f62f4c363acd247af781aed29dc4955..e6b33a683509d76c82230c99283e14c65b095f15 100644 (file)
@@ -95,6 +95,7 @@ public:
 
 private:
      static bool detectors_configured;
+     static bool dynamic_counts_imported;
      static uint32_t unknown_app_idx;
      static std::map<AppId, uint32_t> appid_detector_pegs_idx;
      static std::vector<PegInfo> appid_detectors_peg_info;