From 7e8e243e68bc6bc4d979e03887d57d75fd36f00b Mon Sep 17 00:00:00 2001 From: Campus Date: Mon, 3 Oct 2016 14:36:51 +0200 Subject: fix check for issue https://github.com/ntop/nDPI/issues/272 --- src/lib/protocols/stun.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/lib/protocols/stun.c') diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c index 1b2bb9843..caebeb066 100644 --- a/src/lib/protocols/stun.c +++ b/src/lib/protocols/stun.c @@ -21,9 +21,8 @@ * along with nDPI. If not, see . * */ - - #include "ndpi_protocols.h" + #ifdef NDPI_PROTOCOL_STUN @@ -87,6 +86,7 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct * */ while(offset < payload_length) { + u_int16_t attribute = ntohs(*((u_int16_t*)&payload[offset])); u_int16_t len = ntohs(*((u_int16_t*)&payload[offset+2])); @@ -120,13 +120,12 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct * break; default: - /* This means this STUN packet cannot be confused with whatsapp voice */ - can_this_be_whatsapp_voice = 0; - break; + /* This means this STUN packet cannot be confused with whatsapp voice */ + can_this_be_whatsapp_voice = 0; + break; } offset += len + 4; } - goto udp_stun_found; } @@ -239,7 +238,7 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct * udp_stun_found: if(can_this_be_whatsapp_voice) - flow->num_stun_udp_pkts++; + flow->num_stun_udp_pkts++; return((flow->num_stun_udp_pkts < MAX_NUM_STUN_PKTS) ? NDPI_IS_NOT_STUN : NDPI_IS_STUN); } -- cgit v1.2.3