From: Mike Stepanek (mstepane) Date: Mon, 21 Sep 2020 12:47:52 +0000 (+0000) Subject: Merge pull request #2488 in SNORT/snort3 from ~MDAGON/snort3:reload_module to master X-Git-Tag: 3.0.3-1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e87965d332432bb781e0fe275cfb5502c05294e6;p=thirdparty%2Fsnort3.git Merge pull request #2488 in SNORT/snort3 from ~MDAGON/snort3:reload_module to master Squashed commit of the following: commit 8b5419bb4e2d4a351616d8b8ddeeb830a685c763 Author: mdagon 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. --- diff --git a/src/managers/module_manager.cc b/src/managers/module_manager.cc index 44f4f2d70..5248f070c 100644 --- a/src/managers/module_manager.cc +++ b/src/managers/module_manager.cc @@ -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 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();