Added checks for giving up faster on IRC and SMTP

This commit is contained in:
Luca Deri
2021-02-09 21:27:09 +01:00
parent 1a557d0918
commit 512f73f381
2 changed files with 4 additions and 10 deletions
+3 -9
View File
@@ -386,17 +386,12 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
u_int8_t space = 0;
NDPI_LOG_DBG(ndpi_struct, "search irc\n");
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC && flow->packet_counter > 70) {
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC && (flow->packet_counter > 10)) {
NDPI_LOG_DBG(ndpi_struct, "exclude irc, packet_counter > 70\n");
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_IRC);
return;
}
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC && flow->packet_counter > 30 &&
flow->l4.tcp.irc_stage2 == 0) {
NDPI_LOG_DBG(ndpi_struct, "exclude irc, packet_counter > 30\n");
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_IRC);
return;
}
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_IRC) {
if (src != NULL && ((u_int32_t)
(packet->current_time_ms - src->irc_ts) < ndpi_struct->irc_timeout)) {
@@ -444,8 +439,6 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
}
}
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC
&& flow->packet_counter == 2 && (packet->payload_packet_len > 400 && packet->payload_packet_len < 1381)) {
for (c1 = 50; c1 < packet->payload_packet_len - 23; c1++) {
@@ -475,6 +468,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
}
}
}
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC &&
ndpi_search_irc_ssl_detect_ninety_percent_but_very_fast(ndpi_struct, flow) != 0) {
return;
+1 -1
View File
@@ -261,7 +261,7 @@ void ndpi_search_mail_smtp_tcp(struct ndpi_detection_module_struct *ndpi_struct,
return;
}
if(!flow->check_extra_packets)
if((!flow->check_extra_packets) || (flow->packet_counter > 12))
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}