config: move cfg of aggressiviness and opportunistic TLS to the new API

This commit is contained in:
Nardi Ivan
2024-01-18 10:21:24 +01:00
committed by Ivan Nardi
parent 4cbe2674ab
commit 311d8b6dae
14 changed files with 73 additions and 186 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str
flow->l4.tcp.ftp_imap_pop_smtp.auth_tls == 0) {
flow->ftp_control_stage = 0;
} else if (flow->l4.tcp.ftp_imap_pop_smtp.auth_tls == 1 &&
ndpi_struct->opportunistic_tls_ftp_enabled) {
ndpi_struct->cfg.ftp_opportunistic_tls_enabled) {
flow->host_server_name[0] = '\0'; /* Remove any data set by other dissectors (eg. SMTP) */
/* Switch classification to FTPS */
ndpi_set_detected_protocol(ndpi_struct, flow,
+1 -1
View File
@@ -110,7 +110,7 @@ static void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_
if(flow->l4.tcp.mail_imap_starttls == 1) {
NDPI_LOG_DBG2(ndpi_struct, "starttls detected\n");
ndpi_int_mail_imap_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_IMAPS);
if(ndpi_struct->opportunistic_tls_imap_enabled) {
if(ndpi_struct->cfg.imap_opportunistic_tls_enabled) {
NDPI_LOG_DBG(ndpi_struct, "Switching to [%d/%d]\n",
flow->detected_protocol_stack[0], flow->detected_protocol_stack[1]);
/* We are done (in IMAP dissector): delegating TLS... */
+1 -1
View File
@@ -174,7 +174,7 @@ static void ndpi_search_mail_pop_tcp(struct ndpi_detection_module_struct
if(packet->payload[0] == '+' && flow->l4.tcp.mail_imap_starttls == 1) {
NDPI_LOG_DBG2(ndpi_struct, "starttls detected\n");
ndpi_int_mail_pop_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_POPS);
if(ndpi_struct->opportunistic_tls_pop_enabled) {
if(ndpi_struct->cfg.pop_opportunistic_tls_enabled) {
NDPI_LOG_DBG(ndpi_struct, "Switching to [%d/%d]\n",
flow->detected_protocol_stack[0], flow->detected_protocol_stack[1]);
/* We are done (in POP dissector): delegating TLS... */
+1 -1
View File
@@ -418,7 +418,7 @@ int ndpi_extra_search_mail_smtp_tcp(struct ndpi_detection_module_struct *ndpi_st
454 TLS not available due to temporary reason"
*/
if(ndpi_struct->opportunistic_tls_smtp_enabled &&
if(ndpi_struct->cfg.smtp_opportunistic_tls_enabled &&
packet->payload_packet_len > 3 && memcmp(packet->payload, "220", 3) == 0) {
rc = 1;
/* Switch classification to SMTPS, keeping the hostname sub-classification (if any) */
+1 -1
View File
@@ -402,7 +402,7 @@ static int stun_search_again(struct ndpi_detection_module_struct *ndpi_struct,
} else if(first_byte <= 63) {
NDPI_LOG_DBG(ndpi_struct, "DTLS\n");
if(ndpi_struct->opportunistic_tls_stun_enabled &&
if(ndpi_struct->cfg.stun_opportunistic_tls_enabled &&
is_dtls(packet->payload, packet->payload_packet_len, &unused)) {
/* Process this DTLS packet via TLS/DTLS code but keep using STUN dissection.
+1 -1
View File
@@ -1163,7 +1163,7 @@ static int ndpi_search_tls_tcp(struct ndpi_detection_module_struct *ndpi_struct,
printf("*** [TLS Block] No more blocks\n");
#endif
/* An ookla flow? */
if((ndpi_struct->aggressiveness_ookla & NDPI_AGGRESSIVENESS_OOKLA_TLS) && /* Feature enabled */
if((ndpi_struct->cfg.ookla_aggressiveness & NDPI_AGGRESSIVENESS_OOKLA_TLS) && /* Feature enabled */
(!something_went_wrong &&
flow->tls_quic.certificate_processed == 1 &&
flow->protos.tls_quic.hello_processed == 1) && /* TLS handshake found without errors */