diff options
author | Luca Deri <deri@ntop.org> | 2019-11-04 22:06:02 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-11-04 22:06:02 +0100 |
commit | 5b2c0f68fe0c9d805f14f49388ea864f2032a64e (patch) | |
tree | c20e3774c9afd2467ff46ee45b32ba7f0be0c1f3 /src/lib/protocols/telnet.c | |
parent | e695dd6eade754b2d50bdf297ca8bdc4105f93ff (diff) |
Telnet fix
Diffstat (limited to 'src/lib/protocols/telnet.c')
-rw-r--r-- | src/lib/protocols/telnet.c | 27 |
1 files changed, 21 insertions, 6 deletions
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; } |