]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2022 in SNORT/snort3 from ~SMINUT/snort3:multiple_reject_take5...
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Thu, 20 Feb 2020 17:52:16 +0000 (17:52 +0000)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Thu, 20 Feb 2020 17:52:16 +0000 (17:52 +0000)
Squashed commit of the following:

commit 46f3ef78a578553e2eedb7f4da91a366b55967fd
Author: Silviu Minut <sminut@cisco.com>
Date:   Wed Feb 19 14:09:50 2020 -0500

    file_api: enable Active only when idx = 0 and misc style edits.

src/detection/fp_detect.cc
src/file_api/file_module.cc
src/managers/action_manager.cc
src/packet_io/active.cc
src/packet_io/active_action.h

index 967ed95e6e184f9089492aba56e013c04c6e41c4..7ec4725c8b6286097269606adbb8f2f189d0c82a 100644 (file)
@@ -52,9 +52,9 @@
 #include "main/snort_config.h"
 #include "main/snort_debug.h"
 #include "managers/action_manager.h"
+#include "packet_io/active.h"
 #include "packet_tracer/packet_tracer.h"
 #include "parser/parser.h"
-#include "packet_io/active.h"
 #include "profiler/profiler_defs.h"
 #include "protocols/icmp4.h"
 #include "protocols/packet_manager.h"
@@ -123,7 +123,7 @@ static inline void fpLogOther(
     // rule actions are queued here (eg reject)
     if ( rtn->listhead->is_plugin_action )
     {
-        snort::Actions::Type idx = rtn->listhead->ruleListNode->mode;
+        Actions::Type idx = rtn->listhead->ruleListNode->mode;
         ActiveAction * act = get_ips_policy()->action[idx];
         if ( act )
             Active::queue(act, p);
index 4910e819b8953807805bfa02fbef475effb5ba0e..4819c388d0f1618f88dc27b891cd86cdeddd1e97 100644 (file)
@@ -422,7 +422,11 @@ bool FileIdModule::begin(const char* fqn, int idx, SnortConfig*)
 bool FileIdModule::end(const char* fqn, int idx, SnortConfig*)
 {
     if (!idx)
+    {
+        if ( need_active )
+            Active::set_enabled();
         return true;
+    }
 
     if ( !strcmp(fqn, "file_id.file_rules") )
     {
@@ -438,9 +442,6 @@ bool FileIdModule::end(const char* fqn, int idx, SnortConfig*)
         fc->process_file_policy_rule(file_rule);
     }
 
-    if ( need_active )
-        Active::set_enabled();
-
     return true;
 }
 
index 10d2e0e3a6c52272c7b73e6e4949f9e5102c7dfa..18ffc445cff6b0a392a00b96bb47fa3601acad63 100644 (file)
@@ -167,7 +167,7 @@ void ActionManager::instantiate(const ActionApi* api, Module* mod, SnortConfig*
         // The plugin actions (e.g. reject, react, etc.) are per policy, per mode.
         // At logging time, they have to be retrieved the way we store them here.
         IpsPolicy* ips = get_ips_policy();
-        snort::Actions::Type idx = rln->mode;
+        Actions::Type idx = rln->mode;
         assert(ips->action[idx] == nullptr);
         ips->action[idx] = act;
 
@@ -260,6 +260,5 @@ IpsActionWrapper* ActionManager::instantiate(const char* name, Module* m)
     return new IpsActionWrapper(api, p);
 }
 
-
 #endif
 
index 0df08bdd6f52d16b742ecf6f968cd676682f3581..d91cfe4ea4918db381f4d88db19beaac82bc9263 100644 (file)
@@ -24,7 +24,6 @@
 #endif
 
 #include "active.h"
-#include "active_action.h"
 
 #include "detection/detection_engine.h"
 #include "log/messages.h"
@@ -36,6 +35,7 @@
 #include "stream/stream.h"
 #include "utils/dnet_header.h"
 
+#include "active_action.h"
 #include "sfdaq.h"
 #include "sfdaq_instance.h"
 #include "sfdaq_module.h"
index 1c2dc0955b61c1ff3b1d88170c69d64696b3a7a1..88f5ff0001e817c97e7401d8a6dda555884e2fb1 100644 (file)
@@ -1,5 +1,5 @@
 //--------------------------------------------------------------------------
-// Copyright (C) 2014-2020 Cisco and/or its affiliates. All rights reserved.
+// Copyright (C) 2020-2020 Cisco and/or its affiliates. All rights reserved.
 //
 // This program is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License Version 2 as published