]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #622 in SNORT/snort3 from tsc_update to master
authorHui Cao (huica) <huica@cisco.com>
Wed, 14 Sep 2016 16:48:46 +0000 (12:48 -0400)
committerHui Cao (huica) <huica@cisco.com>
Wed, 14 Sep 2016 16:48:46 +0000 (12:48 -0400)
Squashed commit of the following:

commit 2cbdfa72cd6f09b8189465341e64ae7e2f1088df
Author: Russ Combs <rucombs@cisco.com>
Date:   Wed Sep 14 11:19:43 2016 -0400

    add missing usec conversions
    add hyperscan single match flag for optimization

src/ips_options/ips_regex.cc
src/latency/packet_latency.cc
src/profiler/rule_profiler.cc
src/profiler/time_profiler.cc
src/search_engines/hyperscan.cc

index 73e0e82c4fc3b356dba2b49caa5dbbc2f05888b4..c5f765a69e3b81a6b3054e0b51292423878ac6b9 100644 (file)
@@ -253,6 +253,7 @@ RegexModule::~RegexModule()
 bool RegexModule::begin(const char*, int, SnortConfig*)
 {
     config.reset();
+    config.pmd.flags |= HS_FLAG_SINGLEMATCH;
     return true;
 }
 
index e770dca85e501325b6d6a2e313968b38a4ec9d8f..ebf12cc02d13518e581aba2224a3a73bd3ef784b 100644 (file)
@@ -359,7 +359,7 @@ TEST_CASE ( "packet latency impl", "[latency]" )
             CHECK_FALSE( impl.fastpath() );
             CHECK( impl.pop(nullptr) );
 
-            CHECK( event_handler.count == 0 );
+            CHECK( event_handler.count == 1 );
             CHECK( log_handler.count == 1 );
         }
 
index cfd7279d146cbdd2c5770c4c6318b58c6f22c8e8..1d6eaf5149bc25a2ae1caf10d6d2da9ff6314e1d 100644 (file)
@@ -46,7 +46,7 @@
 #include "catch/catch.hpp"
 #endif
 
-#define s_rule_table_title "Rule Profile Statistics"
+#define s_rule_table_title "rule profile"
 
 static inline OtnState& operator+=(OtnState& lhs, const OtnState& rhs)
 {
@@ -228,17 +228,17 @@ static void print_single_entry(const View& v, unsigned n)
         table << n; // #
 
         table << v.sig_info.generator; // gid
-        table << v.sig_info.id; // sid
-        table << v.sig_info.rev; // rev
+        table << v.sig_info.id;        // sid
+        table << v.sig_info.rev;
 
-        table << v.checks(); // checks
-        table << v.matches(); // matches
-        table << v.alerts(); // alerts
+        table << v.checks();
+        table << v.matches();
+        table << v.alerts();
 
-        table << duration_cast<microseconds>(v.elapsed()).count(); // time
-        table << duration_cast<microseconds>(v.avg_check()).count(); // avg/check
-        table << duration_cast<microseconds>(v.avg_match()).count(); // avg/match
-        table << duration_cast<microseconds>(v.avg_no_match()).count(); // avg/non-match
+        table << clock_usecs(duration_cast<microseconds>(v.elapsed()).count());
+        table << clock_usecs(duration_cast<microseconds>(v.avg_check()).count());
+        table << clock_usecs(duration_cast<microseconds>(v.avg_match()).count());
+        table << clock_usecs(duration_cast<microseconds>(v.avg_no_match()).count());
 
         table << v.timeouts();
         table << v.suspends();
index fdcd693dbd58573482404485746f2b47f8aaa503..b0e0f4ed72a6d57a8b164b24cc21c53852444258 100644 (file)
@@ -134,7 +134,7 @@ static void print_fn(StatsTable& t, const View& v)
     t << clock_usecs(duration_cast<microseconds>(v.elapsed()).count());
 
     // avg/check
-    t << duration_cast<microseconds>(v.avg_check()).count();
+    t << clock_usecs(duration_cast<microseconds>(v.avg_check()).count());
 }
 
 } // namespace time_stats
index 724756f36e3f339ca97a0c05c481758d7d74d4fc..84c33e68d788690c604973567777130fa6f1cb67 100644 (file)
@@ -207,7 +207,7 @@ int HyperscanMpse::prep_patterns(SnortConfig* sc)
     for ( auto& p : pvector )
     {
         pats.push_back(p.pat.c_str());
-        flags.push_back(p.flags);
+        flags.push_back(p.flags | HS_FLAG_SINGLEMATCH);
         ids.push_back(id++);
     }