From 044ed14b4f23708ec05f5b5c85ca29acbf4b59db Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 24 Sep 2020 23:26:03 +0200 Subject: Various optimizations to reduce not-necessary calls Optimized various UDP dissectors Removed dead protocols such as pando and pplive --- src/lib/protocols/edonkey.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/lib/protocols/edonkey.c') diff --git a/src/lib/protocols/edonkey.c b/src/lib/protocols/edonkey.c index ca5abebad..9f73592f8 100644 --- a/src/lib/protocols/edonkey.c +++ b/src/lib/protocols/edonkey.c @@ -165,8 +165,11 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct, return; } - if(payload_len == 0) return; - + if(payload_len == 0) { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); + return; + } + /* Check if we so far detected the protocol in the request or not. */ if(flow->edonkey_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "EDONKEY stage 0: \n"); @@ -176,7 +179,8 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct, /* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */ flow->edonkey_stage = packet->packet_direction + 1; - } + } else + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); } else { NDPI_LOG_DBG2(ndpi_struct, "EDONKEY stage %u: \n", flow->edonkey_stage); @@ -193,8 +197,10 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct, NDPI_LOG_DBG2(ndpi_struct, "The reply did not seem to belong to EDONKEY, resetting the stage to 0\n"); flow->edonkey_stage = 0; } - } + + if(flow->packet_counter > 5) + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); } void ndpi_search_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { -- cgit v1.2.3