diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-07-28 12:39:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-28 12:39:18 +0200 |
commit | 172e698bb8239d0060d9d494adfba928507f95b2 (patch) | |
tree | f5637b5f324a99d7186421daa57cd99a337db798 /src/lib/ndpi_main.c | |
parent | d8d525fff2dc34db62de2598767046de813e4f0d (diff) |
TINC: avoid processing SYN packets (#1676)
Since e6b332aa, we have proper support for detecting client/server
direction. So Tinc dissector is now able to properly initialize the
cache entry only when needed and not anymore at the SYN time; initializing
that entry for **every** SYN packets was a complete waste of resources.
Since 4896dabb, the various `struct ndpi_call_function_struct`
structures are not more separate objects and therefore comparing them
using only their pointers is bogus: this bug was triggered by this
change because `ndpi_str->callback_buffer_size_tcp_no_payload` is now 0.
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 9337d003f..86e94e3aa 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -5280,10 +5280,10 @@ static u_int32_t check_ndpi_detection_func(struct ndpi_detection_module_struct * struct ndpi_flow_struct * const flow, NDPI_SELECTION_BITMASK_PROTOCOL_SIZE const ndpi_selection_packet, struct ndpi_call_function_struct const * const callback_buffer, - uint32_t callback_buffer_size) + uint32_t callback_buffer_size, + int is_tcp_without_payload) { void *func = NULL; - u_int8_t is_tcp_without_payload = (callback_buffer == ndpi_str->callback_buffer_tcp_no_payload); u_int32_t num_calls = 0; u_int16_t proto_index = ndpi_str->proto_defaults[flow->guessed_protocol_id].protoIdx; u_int16_t proto_id = ndpi_str->proto_defaults[flow->guessed_protocol_id].protoId; @@ -5349,7 +5349,7 @@ u_int32_t check_ndpi_other_flow_func(struct ndpi_detection_module_struct *ndpi_s { return check_ndpi_detection_func(ndpi_str, flow, *ndpi_selection_packet, ndpi_str->callback_buffer_non_tcp_udp, - ndpi_str->callback_buffer_size_non_tcp_udp); + ndpi_str->callback_buffer_size_non_tcp_udp, 0); } /* ************************************************ */ @@ -5360,7 +5360,7 @@ static u_int32_t check_ndpi_udp_flow_func(struct ndpi_detection_module_struct *n { return check_ndpi_detection_func(ndpi_str, flow, *ndpi_selection_packet, ndpi_str->callback_buffer_udp, - ndpi_str->callback_buffer_size_udp); + ndpi_str->callback_buffer_size_udp, 0); } /* ************************************************ */ @@ -5372,12 +5372,12 @@ static u_int32_t check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *n if (ndpi_str->packet.payload_packet_len != 0) { return check_ndpi_detection_func(ndpi_str, flow, *ndpi_selection_packet, ndpi_str->callback_buffer_tcp_payload, - ndpi_str->callback_buffer_size_tcp_payload); + ndpi_str->callback_buffer_size_tcp_payload, 0); } else { /* no payload */ return check_ndpi_detection_func(ndpi_str, flow, *ndpi_selection_packet, ndpi_str->callback_buffer_tcp_no_payload, - ndpi_str->callback_buffer_size_tcp_no_payload); + ndpi_str->callback_buffer_size_tcp_no_payload, 1); } } |