diff options
author | Luca Deri <deri@ntop.org> | 2024-05-20 12:17:04 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2024-05-20 12:17:04 +0200 |
commit | 2093ac5bf6444db290cdf1c7d64cf4b80f415d2f (patch) | |
tree | 5dc382739fd26eac2f0490f3e76e630b137b683c /src/lib/protocols/socks45.c | |
parent | 42dba2e4afd12ab77073cc21df1d56d0ef02b232 (diff) |
Minor dissector optimizations
Diffstat (limited to 'src/lib/protocols/socks45.c')
-rw-r--r-- | src/lib/protocols/socks45.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/lib/protocols/socks45.c b/src/lib/protocols/socks45.c index 742e0a6e6..78a744087 100644 --- a/src/lib/protocols/socks45.c +++ b/src/lib/protocols/socks45.c @@ -40,12 +40,6 @@ static void ndpi_check_socks4(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_packet_struct *packet = &ndpi_struct->packet; u_int32_t payload_len = packet->payload_packet_len; - /* Break after 10 packets. */ - if(flow->packet_counter > 10) { - NDPI_EXCLUDE_PROTO(ndpi_struct, flow); - return; - } - /* Check if we so far detected the protocol in the request or not. */ if(flow->socks4_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "SOCKS4 stage 0: \n"); @@ -81,12 +75,6 @@ static void ndpi_check_socks5(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_packet_struct *packet = &ndpi_struct->packet; u_int32_t payload_len = packet->payload_packet_len; - /* Break after 10 packets. */ - if(flow->packet_counter > 10) { - NDPI_EXCLUDE_PROTO(ndpi_struct, flow); - return; - } - /* Check if we so far detected the protocol in the request or not. */ if(flow->socks5_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "SOCKS5 stage 0: \n"); @@ -123,6 +111,11 @@ static void ndpi_search_socks(struct ndpi_detection_module_struct *ndpi_struct, { NDPI_LOG_DBG(ndpi_struct, "search SOCKS\n"); + if(flow->packet_counter >= 10) { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); + return; + } + ndpi_check_socks4(ndpi_struct, flow); if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_SOCKS) |