From: Adrian Mamolea (admamole) Date: Fri, 7 Nov 2025 03:04:00 +0000 (+0000) Subject: Pull request #4979: http_inspect: rename request and response buffers X-Git-Tag: 3.10.0.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=836941a2bee75d4335c797f8ca064f0a9005148e;p=thirdparty%2Fsnort3.git Pull request #4979: http_inspect: rename request and response buffers Merge in SNORT/snort3 from ~ADMAMOLE/snort3:rename_fields to master Squashed commit of the following: commit 6d5aa070aea3445990211f5e2d20d776180f438b Author: Adrian Mamolea Date: Wed Nov 5 12:04:55 2025 -0500 http_inspect: rename request and response buffers --- diff --git a/src/log/unified2.h b/src/log/unified2.h index 4db3822c9..ab8b780fd 100644 --- a/src/log/unified2.h +++ b/src/log/unified2.h @@ -96,8 +96,8 @@ struct Unified2Event char app_name[MAX_EVENT_APPNAME_LEN]; - uint32_t request_size; - uint32_t response_size; + uint32_t http_request_size; + uint32_t http_response_size; char http_method[MAX_HTTP_METHOD_LEN]; char http_version[MAX_HTTP_VERSION_LEN]; diff --git a/src/loggers/unified2.cc b/src/loggers/unified2.cc index 5caf12199..2ca384930 100644 --- a/src/loggers/unified2.cc +++ b/src/loggers/unified2.cc @@ -242,11 +242,11 @@ static void alert_event(Packet* p, const char*, Unified2Config* config, const Ev strncpy(u2_event.http_method, reinterpret_cast(buf.data), MAX_HTTP_METHOD_LEN - 1); - if ( gadget->get_buf("request_size", p, buf) ) - u2_event.request_size = htonl(*reinterpret_cast(buf.data)); + if ( gadget->get_buf("http_request_size", p, buf) ) + u2_event.http_request_size = htonl(*reinterpret_cast(buf.data)); - if ( gadget->get_buf("response_size", p, buf) ) - u2_event.response_size = htonl(*reinterpret_cast(buf.data)); + if ( gadget->get_buf("http_response_size", p, buf) ) + u2_event.http_response_size = htonl(*reinterpret_cast(buf.data)); if ( gadget->get_buf("http_version_str", p, buf) ) strncpy(u2_event.http_version, diff --git a/src/service_inspectors/http_inspect/http_api.h b/src/service_inspectors/http_inspect/http_api.h index b0e015e7c..1d0d7a132 100644 --- a/src/service_inspectors/http_inspect/http_api.h +++ b/src/service_inspectors/http_inspect/http_api.h @@ -49,8 +49,8 @@ "js_data", \ "vba_data", \ "http_method_str", \ - "request_size", \ - "response_size", \ + "http_request_size", \ + "http_response_size", \ "http_version_str", \ "http_user_agent_str", \ "http_referer_str", \ diff --git a/src/service_inspectors/http_inspect/http_enum.h b/src/service_inspectors/http_inspect/http_enum.h index 1a18a4982..1f384b149 100755 --- a/src/service_inspectors/http_inspect/http_enum.h +++ b/src/service_inspectors/http_inspect/http_enum.h @@ -56,7 +56,7 @@ enum HTTP_RULE_OPT { HTTP_BUFFER_CLIENT_BODY = 2, HTTP_BUFFER_COOKIE, HTTP_BUFFE HTTP_BUFFER_RAW_TRAILER, HTTP_BUFFER_RAW_URI, HTTP_BUFFER_STAT_CODE, HTTP_BUFFER_STAT_MSG, HTTP_BUFFER_TRAILER, HTTP_BUFFER_TRUE_IP, HTTP_BUFFER_URI, HTTP_BUFFER_VERSION, BUFFER_JS_DATA, BUFFER_VBA_DATA, HTTP__BUFFER_MAX = BUFFER_VBA_DATA, - HTTP_BUFFER_METHOD_STR, BUFFER_REQUEST_SIZE, BUFFER_RESPONSE_SIZE, + HTTP_BUFFER_METHOD_STR, HTTP_BUFFER_REQUEST_SIZE, HTTP_BUFFER_RESPONSE_SIZE, HTTP_BUFFER_VERSION_STR, HTTP_BUFFER_USER_AGENT_STR, HTTP_BUFFER_REFERER_STR, DETAIL_119_20, DETAIL_119_287, HTTP__TMP_BUFFER_MAX = DETAIL_119_287, diff --git a/src/service_inspectors/http_inspect/http_msg_section.cc b/src/service_inspectors/http_inspect/http_msg_section.cc index b31571d95..320b933cb 100644 --- a/src/service_inspectors/http_inspect/http_msg_section.cc +++ b/src/service_inspectors/http_inspect/http_msg_section.cc @@ -128,7 +128,7 @@ Field* HttpMsgSection::compute_http_method_str(const HttpBufferInfo&) return tmp_field(get_classic_buffer(HTTP_BUFFER_METHOD, 0, 0)); } -Field* HttpMsgSection::compute_request_size(const HttpBufferInfo&) +Field* HttpMsgSection::compute_http_request_size(const HttpBufferInfo&) { uint32_t val = 0; val += get_section_len(request); @@ -138,7 +138,7 @@ Field* HttpMsgSection::compute_request_size(const HttpBufferInfo&) return tmp_field(val); } -Field* HttpMsgSection::compute_response_size(const HttpBufferInfo&) +Field* HttpMsgSection::compute_http_response_size(const HttpBufferInfo&) { uint32_t val = 0; val += get_section_len(status); @@ -212,8 +212,8 @@ const Field& HttpMsgSection::get_tmp_buffer(const HttpBufferInfo& buf) static const ComputeFunction compute_functions[TMP_BUFFER_CNT] = { &HttpMsgSection::compute_http_method_str, // HTTP_BUFFER_METHOD_STR - &HttpMsgSection::compute_request_size, // BUFFER_REQUEST_SIZE - &HttpMsgSection::compute_response_size, // BUFFER_RESPONSE_SIZE + &HttpMsgSection::compute_http_request_size, // HTTP_BUFFER_REQUEST_SIZE + &HttpMsgSection::compute_http_response_size, // HTTP_BUFFER_RESPONSE_SIZE &HttpMsgSection::compute_http_version_str, // HTTP_BUFFER_VERSION_STR &HttpMsgSection::compute_http_user_agent_str, // HTTP_BUFFER_USER_AGENT_STR &HttpMsgSection::compute_http_referer_str, // HTTP_BUFFER_REFERER_STR diff --git a/src/service_inspectors/http_inspect/http_msg_section.h b/src/service_inspectors/http_inspect/http_msg_section.h index 442a5543e..b5472ec46 100644 --- a/src/service_inspectors/http_inspect/http_msg_section.h +++ b/src/service_inspectors/http_inspect/http_msg_section.h @@ -146,8 +146,8 @@ protected: private: const Field& get_tmp_buffer(const HttpBufferInfo& buf); Field* compute_http_method_str(const HttpBufferInfo& buf); - Field* compute_request_size(const HttpBufferInfo& buf); - Field* compute_response_size(const HttpBufferInfo& buf); + Field* compute_http_request_size(const HttpBufferInfo& buf); + Field* compute_http_response_size(const HttpBufferInfo& buf); Field* compute_http_version_str(const HttpBufferInfo& buf); Field* compute_http_user_agent_str(const HttpBufferInfo& buf); Field* compute_http_referer_str(const HttpBufferInfo& buf); diff --git a/tools/u2spewfoo/u2spewfoo.cc b/tools/u2spewfoo/u2spewfoo.cc index d3915d952..e13f134d4 100644 --- a/tools/u2spewfoo/u2spewfoo.cc +++ b/tools/u2spewfoo/u2spewfoo.cc @@ -351,10 +351,10 @@ static void event3_dump(u2record* record) if (event.http_method[0]) printf("\tHTTP Method: %s\n", event.http_method); - if (event.request_size) - printf("\tRequest Size: %u\n", htonl(event.request_size)); - if (event.response_size) - printf("\tResponse Size: %u\n", htonl(event.response_size)); + if (event.http_request_size) + printf("\tHTTP Request Size: %u\n", htonl(event.http_request_size)); + if (event.http_response_size) + printf("\tHTTP Response Size: %u\n", htonl(event.http_response_size)); if (event.http_version[0]) printf("\tHTTP Version: %s\n", event.http_version); if (event.http_user_agent[0])