diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-07-07 17:49:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 17:49:35 +0200 |
commit | ff4e010501ff057e353c7f1d9785b5caadceade3 (patch) | |
tree | fc012ec6770e3f78d857caab0080b641a21737e8 /src/lib/ndpi_main.c | |
parent | d254ae54f3af143ff34c2657c028cda4198e9e9c (diff) |
Avoid spurious calls to extra dissection (#1648)
If the extra callabck is not set, calling the extra dissection is only a
waste of resources...
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index ee338ce76..795a7fe80 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -6097,8 +6097,10 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct return(ret); } - if(ndpi_str->max_packets_to_process > 0 && flow->num_processed_pkts >= ndpi_str->max_packets_to_process) + if(ndpi_str->max_packets_to_process > 0 && flow->num_processed_pkts >= ndpi_str->max_packets_to_process) { + flow->extra_packets_func = NULL; /* To allow ndpi_extra_dissection_possible() to fail */ return(ret); /* Avoid spending too much time with this flow */ + } flow->num_processed_pkts++; @@ -8043,6 +8045,9 @@ u_int8_t ndpi_extra_dissection_possible(struct ndpi_detection_module_struct *ndp proto); #endif + if(!flow->extra_packets_func) + return(0); + switch(proto) { case NDPI_PROTOCOL_TLS: case NDPI_PROTOCOL_DTLS: @@ -8091,19 +8096,10 @@ u_int8_t ndpi_extra_dissection_possible(struct ndpi_detection_module_struct *ndp break; case NDPI_PROTOCOL_SKYPE_TEAMS: - if(flow->extra_packets_func) - return(1); - break; - case NDPI_PROTOCOL_QUIC: - if(flow->extra_packets_func) - return(1); - break; - case NDPI_PROTOCOL_KERBEROS: case NDPI_PROTOCOL_SNMP: - if(flow->extra_packets_func) - return(1); + return(1); break; case NDPI_PROTOCOL_BITTORRENT: |