]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2526 in SNORT/snort3 from ~SATHIRKA/snort3:tp_reload_idle_prune...
authorShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Fri, 2 Oct 2020 20:57:36 +0000 (20:57 +0000)
committerShravan Rangarajuvenkata (shrarang) <shrarang@cisco.com>
Fri, 2 Oct 2020 20:57:36 +0000 (20:57 +0000)
Squashed commit of the following:

commit ade3c12d86fec754e94b5651710d4bebbe696561
Author: Sreeja Athirkandathil Narayanan <sathirka@cisco.com>
Date:   Mon Sep 28 15:05:59 2020 -0400

    appid: inform third-party about snort's idle state during reload

src/network_inspectors/appid/appid_module.cc
src/network_inspectors/appid/test/tp_mock.cc
src/network_inspectors/appid/tp_appid_module_api.h

index ee4e24678cba03c6dd690726cbfd55ec07d296ab..9a661019a5397ff5c32362b19cc1b12c5560a305 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "host_tracker/host_cache.h"
 #include "log/messages.h"
+#include "main/analyzer.h"
 #include "main/analyzer_command.h"
 #include "main/snort.h"
 #include "main/swapper.h"
@@ -179,11 +180,15 @@ private:
     bool from_shell;
 };
 
-bool ACThirdPartyAppIdContextUnload::execute(Analyzer&, void**)
+bool ACThirdPartyAppIdContextUnload::execute(Analyzer& ac, void**)
 {
     assert(pkt_thread_tp_appid_ctxt);
     pkt_thread_tp_appid_ctxt->set_tp_reload_in_progress(true);
-    bool reload_in_progress = pkt_thread_tp_appid_ctxt->tfini(true);
+    bool reload_in_progress;
+    if (ac.is_idling())
+        reload_in_progress = pkt_thread_tp_appid_ctxt->tfini(true, true);
+    else
+        reload_in_progress = pkt_thread_tp_appid_ctxt->tfini(true);
     if (reload_in_progress)
         return false;
     pkt_thread_tp_appid_ctxt = nullptr;
index ba8641d9138f14b096b1fcd4523b7213dd24b554..4ac4057c5275c2c4426e830380449ce9b3e1af0c 100644 (file)
@@ -56,7 +56,7 @@ public:
     }
 
     int tinit() override { return 0; }
-    bool tfini(bool) override { return false; }
+    bool tfini(bool, bool) override { return false; }
 };
 
 class ThirdPartyAppIdSessionImpl : public ThirdPartyAppIdSession
index b34bb8ca8215ea13f14ebdbc89cd448018119ace..8c4ede4dafe50ca8fdb8f56524471bf3e2d590fa 100644 (file)
@@ -60,7 +60,7 @@ public:
     const std::string& module_name() const { return name; }
 
     virtual int tinit() = 0;
-    virtual bool tfini(bool reload = false) = 0;
+    virtual bool tfini(bool reload = false, bool is_idling = false) = 0;
 
     virtual const ThirdPartyConfig& get_config() const { return cfg; }