]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1336 in SNORT/snort3 from onload to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 20 Aug 2018 20:46:26 +0000 (16:46 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 20 Aug 2018 20:46:26 +0000 (16:46 -0400)
Squashed commit of the following:

commit 256a612f39b3ad7ccdb5294e215d2383b1072ffc
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Fri Aug 17 14:41:34 2018 -0400

    detection: avoid repeating detection by always doing non-fast-pattern rules immediately

src/detection/fp_detect.cc

index b45c1a63640bde47577b35849cf32875b75b102d..4b1486e5426f66195a186c651f9cd5e7272b6991 100644 (file)
@@ -90,13 +90,12 @@ THREAD_LOCAL ProfileStats ruleNFPEvalPerfStats;
 // every packet so this only sets the necessary counters to
 // zero which saves us time.
 
-static inline void init_match_info(OtnxMatchData* o, bool do_fp)
+static inline void init_match_info(OtnxMatchData* o)
 {
     for ( int i = 0; i < o->iMatchInfoArraySize; i++ )
         o->matchInfo[i].iMatchCount = 0;
 
     o->have_match = false;
-    o->do_fp = do_fp;
 }
 
 // called by fpLogEvent(), which does the filtering etc.
@@ -1004,16 +1003,13 @@ static inline int fpEvalHeaderSW(PortGroup* port_group, Packet* p,
         p->packet_flags &= ~PKT_IP_RULE;
     }
 
-    if ( omd->do_fp and DetectionEngine::content_enabled(p) )
+    if ( DetectionEngine::content_enabled(p) )
     {
         if ( fp->get_stream_insert() || !(p->packet_flags & PKT_STREAM_INSERT) )
             if ( fp_search(port_group, p, check_ports, type, omd) )
                 return 0;
     }
 
-    if ( DetectionEngine::offloaded(p) )
-        return 0;
-
     do
     {
         if (port_group->nfp_rule_count)
@@ -1286,7 +1282,7 @@ void fp_local(Packet* p)
     MpseStash* stash = c->stash;
     stash->enable_process();
     stash->init();
-    init_match_info(c->otnx, true);
+    init_match_info(c->otnx);
     fpEvalPacket(p);
     fpFinalSelectEvent(c->otnx, p);
 }
@@ -1298,7 +1294,7 @@ void fp_offload(Packet* p)
     stash->enable_process();
     stash->init();
     stash->disable_process();
-    init_match_info(c->otnx, true);
+    init_match_info(c->otnx);
     fpEvalPacket(p);
 }
 
@@ -1308,7 +1304,6 @@ void fp_onload(Packet* p)
     MpseStash* stash = c->stash;
     stash->enable_process();
     stash->process(rule_tree_match, c->otnx);
-    fpEvalPacket(p);
     fpFinalSelectEvent(c->otnx, p);
 }