From: Shravan Rangarajuvenkata (shrarang) Date: Mon, 16 Dec 2019 11:37:54 +0000 (+0000) Subject: Merge pull request #1894 in SNORT/snort3 from ~SATHIRKA/snort3:navl_reload_command... X-Git-Tag: 3.0.0-267~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb8dbe3e7220960b8f7b8b1b6daf55f6bfff9926;p=thirdparty%2Fsnort3.git Merge pull request #1894 in SNORT/snort3 from ~SATHIRKA/snort3:navl_reload_command to master Squashed commit of the following: commit a968abdae0d74e6b983a707fd9895b6f3909b96d Author: Sreeja Athirkandathil Narayanan Date: Thu Dec 12 12:11:46 2019 -0500 appid: Adding command for third-party reload --- diff --git a/src/network_inspectors/appid/appid_module.cc b/src/network_inspectors/appid/appid_module.cc index 144307a3b..1336a7dec 100644 --- a/src/network_inspectors/appid/appid_module.cc +++ b/src/network_inspectors/appid/appid_module.cc @@ -31,6 +31,8 @@ #include "log/messages.h" #include "main/analyzer_command.h" #include "main/snort.h" +#include "main/swapper.h" +#include "main/thread_config.h" #include "profiler/profiler.h" #include "utils/util.h" @@ -170,6 +172,26 @@ static int disable_debug(lua_State*) return 0; } +static int reload_third_party(lua_State*) +{ + if (Swapper::get_reload_in_progress()) + { + LogMessage("== reload pending; retry\n"); + return 0; + } + + if (ThreadConfig::get_instance_max() != 1) + LogMessage("Third-party reload not supported with more than one packet thread."); + else + { + Swapper::set_reload_in_progress(true); + LogMessage(".. reloading third-party"); + Swapper::set_reload_in_progress(false); + } + + return 0; +} + static const Parameter enable_debug_params[] = { { "proto", Parameter::PT_INT, nullptr, nullptr, "numerical IP protocol ID filter" }, @@ -185,6 +207,7 @@ static const Command appid_cmds[] = { { "enable_debug", enable_debug, enable_debug_params, "enable appid debugging"}, { "disable_debug", disable_debug, nullptr, "disable appid debugging"}, + { "reload_third_party", reload_third_party, nullptr, "reload appid third-party module" }, { nullptr, nullptr, nullptr, nullptr } };