]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2139 in SNORT/snort3 from ~DERAMADA/snort3:hi_fix_reload_extradat...
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 8 Apr 2020 20:10:23 +0000 (20:10 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 8 Apr 2020 20:10:23 +0000 (20:10 +0000)
Squashed commit of the following:

commit 20bc030a4319888448db93d56abd040b5a3f624e
Author: deramada <deramada@cisco.com>
Date:   Mon Apr 6 10:25:37 2020 -0400

    http_inspect: register extra-data callbacks in constructor

src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/http_inspect/http_inspect.h

index 77336a682fd142b6c0ec66a9a2098d2474744082..f6f8d57e45f50fc4a31aff696b61f86777842cdc 100644 (file)
@@ -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;
index 58ce5f2d494cfc132495b8022a0c95d5e7f8e118..356ecda7a1d416df7106928f53fb5c1596a14672 100644 (file)
@@ -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;
 };