diff options
author | Luca Deri <deri@ntop.org> | 2021-10-27 00:05:48 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-10-27 00:06:05 +0200 |
commit | f41d8ac1068ac66f2e444f3107cb5bc6a65da8ec (patch) | |
tree | 27e41f62d26180a26260477545aace98cf717a57 /src/lib/protocols/stun.c | |
parent | 41765efcf8159fd8b9dcf4ceca60fbd37e6e79e8 (diff) |
Improved STUN and RTP detection
Diffstat (limited to 'src/lib/protocols/stun.c')
-rw-r--r-- | src/lib/protocols/stun.c | 8 |
1 files changed, 5 insertions, 3 deletions
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) |