aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c2
-rw-r--r--src/lib/protocols/stun.c16
2 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 9d9c38edc..994f09848 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -3006,7 +3006,7 @@ void check_ndpi_udp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
}
for(a = 0; a < ndpi_struct->callback_buffer_size_udp; a++) {
- if((func != ndpi_struct->callback_buffer_tcp_payload[a].func)
+ if((func != ndpi_struct->callback_buffer_udp[a].func)
&& (ndpi_struct->callback_buffer_udp[a].ndpi_selection_bitmask & *ndpi_selection_packet) ==
ndpi_struct->callback_buffer_udp[a].ndpi_selection_bitmask
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c
index 69e1cad52..e21f9331b 100644
--- a/src/lib/protocols/stun.c
+++ b/src/lib/protocols/stun.c
@@ -27,7 +27,7 @@
#ifdef NDPI_PROTOCOL_STUN
-#define MAX_NUM_STUN_PKTS 6
+#define MAX_NUM_STUN_PKTS 10
struct stun_packet_header {
@@ -55,8 +55,13 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
u_int16_t msg_type, msg_len;
struct stun_packet_header *h = (struct stun_packet_header*)payload;
- if(payload_length < sizeof(struct stun_packet_header))
- return(NDPI_IS_NOT_STUN);
+ if(payload_length < sizeof(struct stun_packet_header)) {
+ if(flow->num_stun_udp_pkts > 0) {
+ *is_whatsapp = 1;
+ return NDPI_IS_STUN; /* This is WhatsApp Voice */
+ } else
+ return(NDPI_IS_NOT_STUN);
+ }
if((strncmp((const char*)payload, (const char*)"RSP/", 4) == 0)
&& (strncmp((const char*)&payload[7], (const char*)" STUN_", 6) == 0)) {
@@ -215,10 +220,7 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
#endif
- if(
- ((flow->num_stun_udp_pkts > 0) && (msg_type == 0x0800))
- || ((msg_type == 0x0800) && (msg_len == 106))
- ) {
+ if((flow->num_stun_udp_pkts > 0) && (msg_type <= 0x00FF)) {
*is_whatsapp = 1;
return NDPI_IS_STUN; /* This is WhatsApp Voice */
} else