From: Oleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) Date: Fri, 31 Mar 2023 07:53:47 +0000 (+0000) Subject: Pull request #3791: http2_inspect: clear flow stream_intf with flow_data X-Git-Tag: 3.1.59.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcbf18afcb0f78d1dfe3f5c3afc600834694cee3;p=thirdparty%2Fsnort3.git Pull request #3791: http2_inspect: clear flow stream_intf with flow_data Merge in SNORT/snort3 from ~VHORBATO/snort3:http2_stream_intf to master Squashed commit of the following: commit 6e6662bc009fddcdd8abc4c4d506f8144847b87b Author: vhorbato Date: Fri Mar 24 19:23:41 2023 +0200 http2_inspect: clear flow stream_intf with flow_data --- diff --git a/src/service_inspectors/http2_inspect/http2_flow_data.cc b/src/service_inspectors/http2_inspect/http2_flow_data.cc index 61c569854..f4fc989b2 100644 --- a/src/service_inspectors/http2_inspect/http2_flow_data.cc +++ b/src/service_inspectors/http2_inspect/http2_flow_data.cc @@ -98,6 +98,8 @@ Http2FlowData::~Http2FlowData() hi_ss[k]->go_away(); delete[] frame_data[k]; } + + flow->stream_intf = nullptr; } HttpFlowData* Http2FlowData::get_hi_flow_data() diff --git a/src/service_inspectors/http_inspect/http_flow_data.cc b/src/service_inspectors/http_inspect/http_flow_data.cc index 5b56d1669..8473d3c42 100644 --- a/src/service_inspectors/http_inspect/http_flow_data.cc +++ b/src/service_inspectors/http_inspect/http_flow_data.cc @@ -50,7 +50,7 @@ uint64_t HttpFlowData::instance_count = 0; #endif HttpFlowData::HttpFlowData(Flow* flow, const HttpParaList* params_) : - FlowData(inspector_id), params(params_) + FlowData(inspector_id), params(params_), flow(flow) { static HttpFlowStreamIntf h1_stream; #ifdef REG_TEST @@ -127,6 +127,9 @@ HttpFlowData::~HttpFlowData() discard_list = discard_list->next; delete tmp; } + + if (!for_httpx) + flow->stream_intf = nullptr; } void HttpFlowData::half_reset(SourceId source_id) diff --git a/src/service_inspectors/http_inspect/http_flow_data.h b/src/service_inspectors/http_inspect/http_flow_data.h index 8e2d7a470..988ab4469 100644 --- a/src/service_inspectors/http_inspect/http_flow_data.h +++ b/src/service_inspectors/http_inspect/http_flow_data.h @@ -144,14 +144,14 @@ private: // *** Inspector => StreamSplitter (facts about the message section that is coming next) HttpCommon::SectionType type_expected[2] = { HttpCommon::SEC_REQUEST, HttpCommon::SEC_STATUS }; bool last_request_was_connect = false; + bool stretch_section_to_packet[2] = { false, false }; + bool accelerated_blocking[2] = { false, false }; z_stream* compress_stream[2] = { nullptr, nullptr }; uint64_t zero_nine_expected = 0; // length of the data from Content-Length field int64_t data_length[2] = { HttpCommon::STAT_NOT_PRESENT, HttpCommon::STAT_NOT_PRESENT }; uint32_t section_size_target[2] = { 0, 0 }; HttpEnums::CompressId compression[2] = { HttpEnums::CMP_NONE, HttpEnums::CMP_NONE }; - bool stretch_section_to_packet[2] = { false, false }; - bool accelerated_blocking[2] = { false, false }; // *** Inspector's internal data about the current message struct FdCallbackContext @@ -217,6 +217,7 @@ private: int64_t hx_stream_id = -1; HttpCommon::HXBodyState hx_body_state[2] = { HttpCommon::HX_BODY_NOT_COMPLETE, HttpCommon::HX_BODY_NOT_COMPLETE }; + snort::Flow* flow; #ifdef REG_TEST static uint64_t instance_count;