]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
move remaining http_inspect thread local to flow data
authorRuss Combs <rucombs@cisco.com>
Sat, 22 Oct 2016 15:08:07 +0000 (11:08 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 18 Jan 2017 14:46:42 +0000 (09:46 -0500)
src/detection/detection_engine.cc
src/events/event_queue.cc
src/service_inspectors/http_inspect/http_flow_data.h
src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/http_inspect/ips_http.cc

index a28aad097fab8d434010b4727c64ae6b10186fa7..7eb2d7a50dd966934bb4121001180e4667c7e645 100644 (file)
@@ -23,6 +23,7 @@
 #include "detection/detection_engine.h"
 #include "events/sfeventq.h"
 #include "filters/sfthreshold.h"
+#include "framework/endianness.h"
 #include "latency/packet_latency.h"
 #include "main/snort.h"
 #include "main/snort_config.h"
index 83b9176b8b29888f2d1d3722230a69c95adf0132..dff83f13215bb87df49087e80d83b8dba352869f 100644 (file)
@@ -69,8 +69,6 @@
 
 #include "sfeventq.h"
 
-static THREAD_LOCAL unsigned s_events = 0;
-
 //-------------------------------------------------
 
 EventQueueConfig* EventQueueConfigNew()
index 1c411af0389b17a9f9c7e24988b9023312ed1e20..e74144c3b9fc01e8e959dadf8bac0e43627f01ac 100644 (file)
@@ -68,6 +68,8 @@ private:
 
     // 0 element refers to client request, 1 element refers to server response
 
+    // FIXIT-P reorganize HttpFlowData to minimize void space
+
     // *** StreamSplitter internal data - scan()
     HttpCutter* cutter[2] = { nullptr, nullptr };
 
index 3156e94327320ba93ee960c21239c4550be31d98..005806045a4105f166816f57ed30d6990cc76d91 100644 (file)
@@ -143,35 +143,34 @@ const Field& HttpInspect::process(const uint8_t* data, const uint16_t dsize, Flo
 
     HttpModule::increment_peg_counts(PEG_INSPECT);
 
-    HttpMsgSection*& latest_section = session_data->latest_section;
     switch (session_data->section_type[source_id])
     {
     case SEC_REQUEST:
-        latest_section = new HttpMsgRequest(
+        session_data->latest_section = new HttpMsgRequest(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_STATUS:
-        latest_section = new HttpMsgStatus(
+        session_data->latest_section = new HttpMsgStatus(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_HEADER:
-        latest_section = new HttpMsgHeader(
+        session_data->latest_section = new HttpMsgHeader(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_BODY_CL:
-        latest_section = new HttpMsgBodyCl(
+        session_data->latest_section = new HttpMsgBodyCl(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_BODY_OLD:
-        latest_section = new HttpMsgBodyOld(
+        session_data->latest_section = new HttpMsgBodyOld(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_BODY_CHUNK:
-        latest_section = new HttpMsgBodyChunk(
+        session_data->latest_section = new HttpMsgBodyChunk(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     case SEC_TRAILER:
-        latest_section = new HttpMsgTrailer(
+        session_data->latest_section = new HttpMsgTrailer(
             data, dsize, session_data, source_id, buf_owner, flow, params);
         break;
     default:
@@ -183,13 +182,13 @@ const Field& HttpInspect::process(const uint8_t* data, const uint16_t dsize, Flo
         return Field::FIELD_NULL;
     }
 
-    latest_section->analyze();
-    latest_section->update_flow();
+    session_data->latest_section->analyze();
+    session_data->latest_section->update_flow();
 
 #ifdef REG_TEST
     if (HttpTestManager::use_test_output())
     {
-        latest_section->print_section(HttpTestManager::get_output_file());
+        session_data->latest_section->print_section(HttpTestManager::get_output_file());
         fflush(HttpTestManager::get_output_file());
         if (HttpTestManager::use_test_input())
         {
@@ -200,8 +199,8 @@ const Field& HttpInspect::process(const uint8_t* data, const uint16_t dsize, Flo
     }
 #endif
 
-    latest_section->publish();
-    return latest_section->get_detect_buf();
+    session_data->latest_section->publish();
+    return session_data->latest_section->get_detect_buf();
 }
 
 void HttpInspect::clear(Packet* p)
index 181c6ab2b5e75a73785c43c043332a8b340f913d..e98f29d6b69fdb1f46a8c838de18cdffd7674449 100644 (file)
@@ -29,6 +29,7 @@
 #include "log/messages.h"
 #include "protocols/packet.h"
 
+#include "http_flow_data.h"
 #include "http_inspect.h"
 #include "http_msg_head_shared.h"