Fixed some invalid TLS guesses
This commit is contained in:
@@ -156,6 +156,7 @@
|
||||
|
||||
/* misc definitions */
|
||||
#define NDPI_DEFAULT_MAX_TCP_RETRANSMISSION_WINDOW_SIZE 0x10000
|
||||
#define NDPI_MAX_NUM_PKTS_PER_FLOW_TO_DISSECT 32
|
||||
|
||||
|
||||
/* TODO: rebuild all memory areas to have a more aligned memory block here */
|
||||
|
||||
@@ -5416,6 +5416,9 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct
|
||||
|
||||
flow->num_processed_pkts++;
|
||||
|
||||
if(flow->num_processed_pkts > NDPI_MAX_NUM_PKTS_PER_FLOW_TO_DISSECT)
|
||||
return(ret); /* Avoid spending too much time with this flow */
|
||||
|
||||
/* Init default */
|
||||
ret.master_protocol = flow->detected_protocol_stack[1],
|
||||
ret.app_protocol = flow->detected_protocol_stack[0];
|
||||
|
||||
@@ -918,10 +918,14 @@ static int ndpi_search_tls_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|
||||
processed += packet->payload_packet_len;
|
||||
}
|
||||
} else {
|
||||
} else if(len > 5 /* Minimum block size */) {
|
||||
/* Process element as a whole */
|
||||
if(content_type == 0x17 /* Application Data */) {
|
||||
ndpi_looks_like_tls(ndpi_struct, flow);
|
||||
u_int32_t block_len = ntohs((flow->l4.tcp.tls.message.buffer[3] << 16) + (flow->l4.tcp.tls.message.buffer[4] << 8));
|
||||
|
||||
/* Let's do a quick check to make sure this really looks like TLS */
|
||||
if(block_len < 16384 /* Max TLS block size */)
|
||||
ndpi_looks_like_tls(ndpi_struct, flow);
|
||||
|
||||
if(flow->l4.tcp.tls.certificate_processed) {
|
||||
if(flow->l4.tcp.tls.num_tls_blocks < ndpi_struct->num_tls_blocks_to_follow)
|
||||
|
||||
Reference in New Issue
Block a user