From 95e16872fadfc98256fdcf729f267237c727e4c3 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Fri, 29 Jul 2022 12:07:14 +0200 Subject: First step in simplify `ndpi_process_extra_packet()` (#1680) Move the prottocol specific logic into the proper dissector code, where it belongs. Next step: remove that list of protocols. Long goal: remove this function altogether... --- src/lib/protocols/tls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols/tls.c') diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 25b765f9e..3e69869c3 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -936,7 +936,7 @@ static int ndpi_search_tls_tcp(struct ndpi_detection_module_struct *ndpi_struct, u_int8_t content_type; if(message->buffer_used < 5) - return(1); /* Keep working */ + break; len = (message->buffer[3] << 8) + message->buffer[4] + 5; @@ -1074,6 +1074,8 @@ static int ndpi_search_tls_tcp(struct ndpi_detection_module_struct *ndpi_struct, if(something_went_wrong || ((ndpi_struct->num_tls_blocks_to_follow > 0) && (flow->l4.tcp.tls.num_tls_blocks == ndpi_struct->num_tls_blocks_to_follow)) + || ((ndpi_struct->num_tls_blocks_to_follow == 0) + && (flow->l4.tcp.tls.certificate_processed == 1)) ) { #ifdef DEBUG_TLS_BLOCKS printf("*** [TLS Block] No more blocks\n"); @@ -1187,7 +1189,7 @@ static int ndpi_search_tls_udp(struct ndpi_detection_module_struct *ndpi_struct, packet->payload = p; packet->payload_packet_len = p_len; /* Restore */ - if(no_dtls || change_cipher_found) { + if(no_dtls || change_cipher_found || flow->l4.tcp.tls.certificate_processed) { NDPI_EXCLUDE_PROTO_EXT(ndpi_struct, flow, NDPI_PROTOCOL_DTLS); flow->check_extra_packets = 0; flow->extra_packets_func = NULL; -- cgit v1.2.3