From: Mike Stepanek (mstepane) Date: Wed, 8 Apr 2020 20:10:23 +0000 (+0000) Subject: Merge pull request #2139 in SNORT/snort3 from ~DERAMADA/snort3:hi_fix_reload_extradat... X-Git-Tag: 3.0.1-2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1bd378c9e3a7f159fb430311bae7ced0af0f94b;p=thirdparty%2Fsnort3.git Merge pull request #2139 in SNORT/snort3 from ~DERAMADA/snort3:hi_fix_reload_extradata_reg to master Squashed commit of the following: commit 20bc030a4319888448db93d56abd040b5a3f624e Author: deramada Date: Mon Apr 6 10:25:37 2020 -0400 http_inspect: register extra-data callbacks in constructor --- diff --git a/src/service_inspectors/http_inspect/http_inspect.cc b/src/service_inspectors/http_inspect/http_inspect.cc index 77336a682..f6f8d57e4 100644 --- a/src/service_inspectors/http_inspect/http_inspect.cc +++ b/src/service_inspectors/http_inspect/http_inspect.cc @@ -52,12 +52,12 @@ using namespace snort; using namespace HttpCommon; using namespace HttpEnums; -uint32_t HttpInspect::xtra_trueip_id; -uint32_t HttpInspect::xtra_uri_id; -uint32_t HttpInspect::xtra_host_id; -uint32_t HttpInspect::xtra_jsnorm_id; - -HttpInspect::HttpInspect(const HttpParaList* params_) : params(params_) +HttpInspect::HttpInspect(const HttpParaList* params_) : + params(params_), + xtra_trueip_id(Stream::reg_xtra_data_cb(get_xtra_trueip)), + xtra_uri_id(Stream::reg_xtra_data_cb(get_xtra_uri)), + xtra_host_id(Stream::reg_xtra_data_cb(get_xtra_host)), + xtra_jsnorm_id(Stream::reg_xtra_data_cb(get_xtra_jsnorm)) { #ifdef REG_TEST if (params->test_input) @@ -83,12 +83,6 @@ bool HttpInspect::configure(SnortConfig* ) if (params->js_norm_param.normalize_javascript) params->js_norm_param.js_norm->configure(); - // FIXIT-H The following four lines are not thread safe during reload - xtra_trueip_id = Stream::reg_xtra_data_cb(get_xtra_trueip); - xtra_uri_id = Stream::reg_xtra_data_cb(get_xtra_uri); - xtra_host_id = Stream::reg_xtra_data_cb(get_xtra_host); - xtra_jsnorm_id = Stream::reg_xtra_data_cb(get_xtra_jsnorm); - config_decode(); return true; diff --git a/src/service_inspectors/http_inspect/http_inspect.h b/src/service_inspectors/http_inspect/http_inspect.h index 58ce5f2d4..356ecda7a 100644 --- a/src/service_inspectors/http_inspect/http_inspect.h +++ b/src/service_inspectors/http_inspect/http_inspect.h @@ -81,10 +81,10 @@ private: const HttpParaList* const params; // Registrations for "extra data" - static uint32_t xtra_trueip_id; - static uint32_t xtra_uri_id; - static uint32_t xtra_host_id; - static uint32_t xtra_jsnorm_id; + const uint32_t xtra_trueip_id; + const uint32_t xtra_uri_id; + const uint32_t xtra_host_id; + const uint32_t xtra_jsnorm_id; snort::DecodeConfig decode_conf; };