aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ndpi_main.c6
-rw-r--r--src/lib/protocols/stun.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 868373d11..1fa2445de 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -3564,9 +3564,6 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
/* TLS+DTLS */
init_tls_dissector(ndpi_str, &a, detection_bitmask);
- /* STUN */
- init_stun_dissector(ndpi_str, &a, detection_bitmask);
-
/* RTP */
init_rtp_dissector(ndpi_str, &a, detection_bitmask);
@@ -3576,6 +3573,9 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
/* RDP */
init_rdp_dissector(ndpi_str, &a, detection_bitmask);
+ /* STUN */
+ init_stun_dissector(ndpi_str, &a, detection_bitmask);
+
/* SIP */
init_sip_dissector(ndpi_str, &a, detection_bitmask);
diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c
index f91be68b2..e1d8f11c8 100644
--- a/src/lib/protocols/stun.c
+++ b/src/lib/protocols/stun.c
@@ -82,7 +82,7 @@ void ndpi_int_stun_add_connection(struct ndpi_detection_module_struct *ndpi_stru
app_proto = cached_proto, proto = NDPI_PROTOCOL_STUN;
} else {
if(app_proto != NDPI_PROTOCOL_STUN) {
- /* No sense to ass STUN, but only subprotocols */
+ /* No sense to add STUN, but only subprotocols */
#ifdef DEBUG_LRU
printf("[LRU] ADDING %u / %u.%u [%u -> %u]\n", key, proto, app_proto,
@@ -180,11 +180,11 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
msg_type = ntohs(*((u_int16_t*)payload));
msg_len = ntohs(*((u_int16_t*)&payload[2]));
- if(msg_type == 0)
+ if((msg_type == 0) || ((msg_len+20) != payload_length))
return(NDPI_IS_NOT_STUN);
/* https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml */
- if((msg_type & 0x3EEF) > 0x000B && msg_type != 0x0800) {
+ if(((msg_type & 0x3EEF) > 0x000B) && (msg_type != 0x0800)) {
#ifdef DEBUG_STUN
printf("[STUN] msg_type = %04X\n", msg_type);
#endif
@@ -489,6 +489,8 @@ void ndpi_search_stun(struct ndpi_detection_module_struct *ndpi_struct, struct n
{
struct ndpi_packet_struct *packet = &ndpi_struct->packet;
+ // printf("==> %s()\n", __FUNCTION__)
+
NDPI_LOG_DBG(ndpi_struct, "search stun\n");
if(packet->payload == NULL)