nDPi now finally honours dissection of HTTP responses
This commit is contained in:
+19
-26
@@ -1141,66 +1141,59 @@ struct ndpi_flow_struct {
|
|||||||
u_int8_t bittorrent_stage; // can be 0 - 255
|
u_int8_t bittorrent_stage; // can be 0 - 255
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
||||||
u_int32_t directconnect_stage:2; // 0 - 1
|
u_int8_t directconnect_stage:2; // 0 - 1
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t sip_yahoo_voice:1;
|
u_int8_t sip_yahoo_voice:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_HTTP */
|
/* NDPI_PROTOCOL_HTTP */
|
||||||
u_int32_t http_detected:1;
|
u_int8_t http_detected:1;
|
||||||
|
u_int16_t http_upper_protocol, http_lower_protocol;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTSP */
|
/* NDPI_PROTOCOL_RTSP */
|
||||||
u_int32_t rtsprdt_stage:2;
|
u_int8_t rtsprdt_stage:2, rtsp_control_flow:1;
|
||||||
u_int32_t rtsp_control_flow:1;
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_detection_finished:2;
|
u_int8_t yahoo_detection_finished:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_ZATTOO */
|
/* NDPI_PROTOCOL_ZATTOO */
|
||||||
u_int32_t zattoo_stage:3;
|
u_int8_t zattoo_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_QQ */
|
/* NDPI_PROTOCOL_QQ */
|
||||||
u_int32_t qq_stage:3;
|
u_int8_t qq_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_THUNDER */
|
/* NDPI_PROTOCOL_THUNDER */
|
||||||
u_int32_t thunder_stage:2; // 0 - 3
|
u_int8_t thunder_stage:2; // 0 - 3
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OSCAR */
|
/* NDPI_PROTOCOL_OSCAR */
|
||||||
u_int32_t oscar_ssl_voice_stage:3;
|
u_int8_t oscar_ssl_voice_stage:3, oscar_video_voice:1;
|
||||||
u_int32_t oscar_video_voice:1;
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_FLORENSIA */
|
/* NDPI_PROTOCOL_FLORENSIA */
|
||||||
u_int32_t florensia_stage:1;
|
u_int8_t florensia_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SOCKS */
|
/* NDPI_PROTOCOL_SOCKS */
|
||||||
u_int32_t socks5_stage:2; // 0 - 3
|
u_int8_t socks5_stage:2, socks4_stage:2; // 0 - 3
|
||||||
u_int32_t socks4_stage:2; // 0 - 3
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_EDONKEY */
|
/* NDPI_PROTOCOL_EDONKEY */
|
||||||
u_int32_t edonkey_stage:2; // 0 - 3
|
u_int8_t edonkey_stage:2; // 0 - 3
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_FTP_CONTROL */
|
/* NDPI_PROTOCOL_FTP_CONTROL */
|
||||||
u_int32_t ftp_control_stage:2;
|
u_int8_t ftp_control_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTMP */
|
/* NDPI_PROTOCOL_RTMP */
|
||||||
u_int32_t rtmp_stage:2;
|
u_int8_t rtmp_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PANDO */
|
/* NDPI_PROTOCOL_PANDO */
|
||||||
u_int32_t pando_stage:3;
|
u_int8_t pando_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_STEAM */
|
/* NDPI_PROTOCOL_STEAM */
|
||||||
u_int32_t steam_stage:3;
|
u_int16_t steam_stage:3, steam_stage1:3, steam_stage2:2, steam_stage3:2;
|
||||||
u_int32_t steam_stage1:3; // 0 - 4
|
|
||||||
u_int32_t steam_stage2:2; // 0 - 2
|
|
||||||
u_int32_t steam_stage3:2; // 0 - 2
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PPLIVE */
|
/* NDPI_PROTOCOL_PPLIVE */
|
||||||
u_int32_t pplive_stage1:3; // 0 - 6
|
u_int8_t pplive_stage1:3, pplive_stage2:2, pplive_stage3:2;
|
||||||
u_int32_t pplive_stage2:2; // 0 - 2
|
|
||||||
u_int32_t pplive_stage3:2; // 0 - 2
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_STARCRAFT */
|
/* NDPI_PROTOCOL_STARCRAFT */
|
||||||
u_int32_t starcraft_udp_stage : 3; // 0-7
|
u_int8_t starcraft_udp_stage : 3; // 0-7
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OPENVPN */
|
/* NDPI_PROTOCOL_OPENVPN */
|
||||||
u_int8_t ovpn_session_id[8];
|
u_int8_t ovpn_session_id[8];
|
||||||
|
|||||||
+4
-9
@@ -3901,8 +3901,7 @@ void check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if((proto_id != NDPI_PROTOCOL_UNKNOWN)
|
if((proto_id != NDPI_PROTOCOL_UNKNOWN)
|
||||||
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
|
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
|
||||||
ndpi_struct->callback_buffer[proto_index].excluded_protocol_bitmask) == 0
|
ndpi_struct->callback_buffer[proto_index].excluded_protocol_bitmask) == 0
|
||||||
&& NDPI_BITMASK_COMPARE(ndpi_struct->callback_buffer[proto_index].detection_bitmask,
|
&& NDPI_BITMASK_COMPARE(ndpi_struct->callback_buffer[proto_index].detection_bitmask, detection_bitmask) != 0
|
||||||
detection_bitmask) != 0
|
|
||||||
&& (ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask & *ndpi_selection_packet) == ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask) {
|
&& (ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask & *ndpi_selection_packet) == ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask) {
|
||||||
if((flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN)
|
if((flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN)
|
||||||
&& (ndpi_struct->proto_defaults[flow->guessed_protocol_id].func != NULL))
|
&& (ndpi_struct->proto_defaults[flow->guessed_protocol_id].func != NULL))
|
||||||
@@ -3920,7 +3919,6 @@ void check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
detection_bitmask) != 0) {
|
detection_bitmask) != 0) {
|
||||||
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
||||||
|
|
||||||
|
|
||||||
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
||||||
break; /* Stop after detecting the first protocol */
|
break; /* Stop after detecting the first protocol */
|
||||||
}
|
}
|
||||||
@@ -4731,14 +4729,13 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
{
|
{
|
||||||
u_int32_t a;
|
u_int32_t a;
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
if(packet->packet_lines_parsed_complete != 0)
|
if(packet->packet_lines_parsed_complete != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
packet->packet_lines_parsed_complete = 1;
|
packet->packet_lines_parsed_complete = 1;
|
||||||
packet->parsed_lines = 0;
|
packet->parsed_lines = 0;
|
||||||
|
|
||||||
packet->empty_line_position_set = 0;
|
packet->empty_line_position_set = 0;
|
||||||
|
|
||||||
packet->host_line.ptr = NULL;
|
packet->host_line.ptr = NULL;
|
||||||
packet->host_line.len = 0;
|
packet->host_line.len = 0;
|
||||||
packet->referer_line.ptr = NULL;
|
packet->referer_line.ptr = NULL;
|
||||||
@@ -4779,7 +4776,6 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
packet->line[packet->parsed_lines].len = 0;
|
packet->line[packet->parsed_lines].len = 0;
|
||||||
|
|
||||||
for(a = 0; a < packet->payload_packet_len; a++) {
|
for(a = 0; a < packet->payload_packet_len; a++) {
|
||||||
|
|
||||||
if((a + 1) == packet->payload_packet_len)
|
if((a + 1) == packet->payload_packet_len)
|
||||||
return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */
|
return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */
|
||||||
|
|
||||||
@@ -4791,7 +4787,6 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
strncasecmp((const char *)packet->line[0].ptr, "HTTP/1.", NDPI_STATICSTRING_LEN("HTTP/1.")) == 0 &&
|
strncasecmp((const char *)packet->line[0].ptr, "HTTP/1.", NDPI_STATICSTRING_LEN("HTTP/1.")) == 0 &&
|
||||||
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] > '0' && /* response code between 000 and 699 */
|
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] > '0' && /* response code between 000 and 699 */
|
||||||
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] < '6') {
|
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] < '6') {
|
||||||
|
|
||||||
packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.1 ")];
|
packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.1 ")];
|
||||||
packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN("HTTP/1.1 ");
|
packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN("HTTP/1.1 ");
|
||||||
packet->http_num_headers++;
|
packet->http_num_headers++;
|
||||||
@@ -4804,6 +4799,7 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
"ndpi_parse_packet_line_info: HTTP response parsed: \"%.*s\"\n",
|
"ndpi_parse_packet_line_info: HTTP response parsed: \"%.*s\"\n",
|
||||||
packet->http_response.len, packet->http_response.ptr);
|
packet->http_response.len, packet->http_response.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Server:" header line in HTTP response */
|
/* "Server:" header line in HTTP response */
|
||||||
if(packet->line[packet->parsed_lines].len > NDPI_STATICSTRING_LEN("Server:") + 1
|
if(packet->line[packet->parsed_lines].len > NDPI_STATICSTRING_LEN("Server:") + 1
|
||||||
&& strncasecmp((const char *)packet->line[packet->parsed_lines].ptr, "Server:", NDPI_STATICSTRING_LEN("Server:")) == 0) {
|
&& strncasecmp((const char *)packet->line[packet->parsed_lines].ptr, "Server:", NDPI_STATICSTRING_LEN("Server:")) == 0) {
|
||||||
@@ -5253,11 +5249,10 @@ void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow) {
|
|||||||
if(flow) {
|
if(flow) {
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
for(a = 0; a < NDPI_PROTOCOL_SIZE; a++) {
|
for(a = 0; a < NDPI_PROTOCOL_SIZE; a++)
|
||||||
flow->detected_protocol_stack[a] = NDPI_PROTOCOL_UNKNOWN;
|
flow->detected_protocol_stack[a] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* ********************************************************************************* */
|
/* ********************************************************************************* */
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ static void ndpi_check_apple_push(struct ndpi_detection_module_struct *ndpi_stru
|
|||||||
struct ndpi_flow_struct *flow) {
|
struct ndpi_flow_struct *flow) {
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
|
if(packet->iph) {
|
||||||
/* https://support.apple.com/en-us/HT203609 */
|
/* https://support.apple.com/en-us/HT203609 */
|
||||||
if(((ntohl(packet->iph->saddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)
|
if(((ntohl(packet->iph->saddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)
|
||||||
|| ((ntohl(packet->iph->daddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)) {
|
|| ((ntohl(packet->iph->daddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)) {
|
||||||
@@ -47,6 +48,7 @@ static void ndpi_check_apple_push(struct ndpi_detection_module_struct *ndpi_stru
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-12
@@ -28,11 +28,13 @@
|
|||||||
#include "ndpi_api.h"
|
#include "ndpi_api.h"
|
||||||
#include "lruc.h"
|
#include "lruc.h"
|
||||||
|
|
||||||
/* global variables used for 1kxun protocol and iqiyi service */
|
|
||||||
|
|
||||||
static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
struct ndpi_flow_struct *flow,
|
struct ndpi_flow_struct *flow,
|
||||||
u_int16_t category) {
|
u_int16_t category) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("[%s] [http_dont_dissect_response: %u]->> %s\n", __FUNCTION__,
|
||||||
|
ndpi_struct->http_dont_dissect_response, flow->http.response_status_code);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||||
/* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */
|
/* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */
|
||||||
@@ -40,16 +42,28 @@ static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *nd
|
|||||||
ndpi_search_tcp_or_udp(ndpi_struct, flow);
|
ndpi_search_tcp_or_udp(ndpi_struct, flow);
|
||||||
|
|
||||||
/* If no custom protocol has been detected */
|
/* If no custom protocol has been detected */
|
||||||
|
|
||||||
if(flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
|
if(flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
|
||||||
ndpi_int_reset_protocol(flow);
|
ndpi_int_reset_protocol(flow);
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_HTTP);
|
flow->http_upper_protocol = flow->guessed_host_protocol_id, flow->http_lower_protocol = NDPI_PROTOCOL_HTTP;
|
||||||
} else
|
} else
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP, NDPI_PROTOCOL_UNKNOWN);
|
flow->http_upper_protocol = NDPI_PROTOCOL_HTTP, flow->http_lower_protocol = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
|
||||||
|
if(ndpi_struct->http_dont_dissect_response)
|
||||||
|
ndpi_set_detected_protocol(ndpi_struct, flow, flow->http_upper_protocol, flow->http_lower_protocol);
|
||||||
|
else {
|
||||||
|
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
flow->packet.detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->packet.detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if((!ndpi_struct->http_dont_dissect_response) && (flow->http.response_status_code[0] == '\0')) {
|
||||||
|
flow->http_upper_protocol = flow->detected_protocol_stack[0], flow->http_lower_protocol = flow->detected_protocol_stack[1];
|
||||||
|
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
flow->packet.detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->packet.detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flow->http_detected = 1, flow->guessed_category = category;
|
flow->http_detected = 1, flow->guessed_category = category;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NDPI_CONTENT_CATEGORY_FLASH
|
#ifdef NDPI_CONTENT_CATEGORY_FLASH
|
||||||
static void flash_check_http_payload(struct ndpi_detection_module_struct
|
static void flash_check_http_payload(struct ndpi_detection_module_struct
|
||||||
@@ -198,6 +212,13 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
u_int8_t a;
|
u_int8_t a;
|
||||||
|
|
||||||
|
if((!ndpi_struct->http_dont_dissect_response) && flow->http_detected && (flow->http.response_status_code[0] != 0)) {
|
||||||
|
ndpi_set_detected_protocol(ndpi_struct, flow, flow->http_upper_protocol, flow->http_lower_protocol);
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("[%s] [http_dont_dissect_response: %u]->> %s\n", __FUNCTION__, ndpi_struct->http_dont_dissect_response, flow->http.response_status_code);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(NDPI_PROTOCOL_1KXUN) || defined(NDPI_PROTOCOL_IQIYI)
|
#if defined(NDPI_PROTOCOL_1KXUN) || defined(NDPI_PROTOCOL_IQIYI)
|
||||||
/* PPStream */
|
/* PPStream */
|
||||||
@@ -378,7 +399,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ndpi_struct->http_dont_dissect_response)
|
if(!ndpi_struct->http_dont_dissect_response)
|
||||||
parseHttpSubprotocol(ndpi_struct, flow);
|
parseHttpSubprotocol(ndpi_struct, flow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -421,8 +442,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
|
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
|
||||||
parseHttpSubprotocol(ndpi_struct, flow);
|
parseHttpSubprotocol(ndpi_struct, flow);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)
|
if(flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)
|
||||||
flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
|
flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
|
||||||
@@ -458,6 +481,8 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
&ret_match, NDPI_PROTOCOL_HTTP);
|
&ret_match, NDPI_PROTOCOL_HTTP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ndpi_int_http_add_connection(ndpi_struct, flow, packet->detected_protocol_stack[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
@@ -676,7 +701,6 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
/* Set the first found headers in request */
|
/* Set the first found headers in request */
|
||||||
flow->http.num_request_headers = packet->http_num_headers;
|
flow->http.num_request_headers = packet->http_num_headers;
|
||||||
|
|
||||||
|
|
||||||
/* Check for Ookla */
|
/* Check for Ookla */
|
||||||
if((packet->referer_line.len > 0)
|
if((packet->referer_line.len > 0)
|
||||||
&& ndpi_strnstr((const char *)packet->referer_line.ptr, "www.speedtest.net", packet->referer_line.len)) {
|
&& ndpi_strnstr((const char *)packet->referer_line.ptr, "www.speedtest.net", packet->referer_line.len)) {
|
||||||
@@ -790,9 +814,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
|
|
||||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||||
http_bitmask_exclude_other(flow);
|
http_bitmask_exclude_other(flow);
|
||||||
|
|
||||||
} else if((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
} else if((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
||||||
|
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "HTTP stage %u: \n", flow->l4.tcp.http_stage);
|
NDPI_LOG_DBG2(ndpi_struct, "HTTP stage %u: \n", flow->l4.tcp.http_stage);
|
||||||
|
|
||||||
if((packet->payload_packet_len == 34) && (flow->l4.tcp.http_stage == 1)) {
|
if((packet->payload_packet_len == 34) && (flow->l4.tcp.http_stage == 1)) {
|
||||||
@@ -879,9 +901,8 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||||
|
|
||||||
if(packet->packet_direction == 1 /* server -> client */){
|
if(packet->packet_direction == 1 /* server -> client */)
|
||||||
flow->http.num_response_headers += packet->http_num_headers; /* flow structs are initialized with zeros */
|
flow->http.num_response_headers += packet->http_num_headers; /* flow structs are initialized with zeros */
|
||||||
}
|
|
||||||
|
|
||||||
if(packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
if(packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "empty line. check_http_payload\n");
|
NDPI_LOG_DBG2(ndpi_struct, "empty line. check_http_payload\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user