aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example/ndpiReader.c2
-rw-r--r--src/lib/protocols/telnet.c27
2 files changed, 22 insertions, 7 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index d7c5630ef..41e33f949 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -89,7 +89,7 @@ static u_int8_t stats_flag = 0, bpf_filter_flag = 0;
static u_int8_t file_first_time = 1;
#endif
u_int8_t human_readeable_string_len = 5;
-u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 32 /* due to telnet */;
+u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */;
static u_int32_t pcap_analysis_duration = (u_int32_t)-1;
static u_int16_t decode_tunnels = 0;
static u_int16_t num_loops = 1;
diff --git a/src/lib/protocols/telnet.c b/src/lib/protocols/telnet.c
index 59b1e4978..0fd00e6d4 100644
--- a/src/lib/protocols/telnet.c
+++ b/src/lib/protocols/telnet.c
@@ -29,14 +29,18 @@
#include "ndpi_api.h"
+/* #define TELNET_DEBUG 1 */
+
/* ************************************************************************ */
static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) {
struct ndpi_packet_struct *packet = &flow->packet;
- // printf("==> %s()\n", __FUNCTION__);
-
+#ifdef TELNET_DEBUG
+ printf("==> %s() [%s]\n", __FUNCTION__, packet->payload);
+#endif
+
if(packet->payload[0] == 0xFF)
return(1);
@@ -81,7 +85,7 @@ static void ndpi_int_telnet_add_connection(struct ndpi_detection_module_struct
/* This is necessary to inform the core to call this dissector again */
flow->check_extra_packets = 1;
- flow->max_extra_packets_to_check = 32;
+ flow->max_extra_packets_to_check = 64;
flow->extra_packets_func = search_telnet_again;
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_TELNET, NDPI_PROTOCOL_UNKNOWN);
@@ -102,6 +106,10 @@ u_int8_t search_iac(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t a;
+#ifdef TELNET_DEBUG
+ printf("==> %s()\n", __FUNCTION__);
+#endif
+
if(packet->payload_packet_len < 3)
return(0);
@@ -147,11 +155,18 @@ void ndpi_search_telnet_tcp(struct ndpi_detection_module_struct *ndpi_struct,
return;
}
- if(((flow->packet_counter < 12) && (flow->l4.tcp.telnet_stage > 0)) || (flow->packet_counter < 6))
+ if(((flow->packet_counter < 12) && (flow->l4.tcp.telnet_stage > 0)) || (flow->packet_counter < 6)) {
+#ifdef TELNET_DEBUG
+ printf("==> [%s:%u] %s()\n", __FILE__, __LINE__, __FUNCTION__);
+#endif
return;
- else
+ } else {
+#ifdef TELNET_DEBUG
+ printf("==> [%s:%u] %s()\n", __FILE__, __LINE__, __FUNCTION__);
+#endif
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
-
+ }
+
return;
}