]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2488 in SNORT/snort3 from ~MDAGON/snort3:reload_module to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 21 Sep 2020 12:47:52 +0000 (12:47 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 21 Sep 2020 12:47:52 +0000 (12:47 +0000)
Squashed commit of the following:

commit 8b5419bb4e2d4a351616d8b8ddeeb830a685c763
Author: mdagon <mdagon@cisco.com>
Date:   Thu Sep 17 14:27:46 2020 -0400

    module_manager: keep a list of modules supporting reload_module.
    Return error for attempts to reload a module that isn't in the list.

src/managers/module_manager.cc

index 44f4f2d701565cfe84f48b4f36dbbb8c66c9a872..5248f070ca0db088c91593765c63fb3d52ea5ae9 100644 (file)
@@ -1102,6 +1102,15 @@ void ModuleManager::reload_module(const char* name, SnortConfig* sc)
 {
     ModHook* h = get_hook(name);
 
+    // Most of the modules don't support yet reload_module.
+    // This list contains the ones that do, and should be updated as
+    // more modules support reload_module.
+    const vector<string> supported_modules =
+    {
+        "dns_si", "firewall", "identity", "qos", "reputation", "url_si"
+    };
+    auto it = find(supported_modules.begin(), supported_modules.end(), name);
+
     // FIXIT-L: we can check that h->api is not null here or inside instantiate.
     // Both alternatives prevent crashing in instantiate(). However,
     // checking it here might be too aggressive, because we are also saying it
@@ -1109,7 +1118,7 @@ void ModuleManager::reload_module(const char* name, SnortConfig* sc)
     // (get_updated_module()) discard other legitimate reload operations, e.g.
     // the newly read configuration. We should decide on this when proper
     // reload functionality gets implemented.
-    if ( h and h->api and h->mod and sc )
+    if ( it != supported_modules.end() and h and h->api and h->mod and sc )
     {
         PluginManager::instantiate(h->api, h->mod, sc);
         s_errors += get_parse_errors();