Hangout: fix usage of STUN function (#1299)

This commit is contained in:
Ivan Nardi
2021-09-13 18:25:43 +02:00
committed by GitHub
parent 3e06e6f5b8
commit 0eb7a0388c
3 changed files with 4 additions and 12 deletions
-3
View File
@@ -49,9 +49,6 @@
#include "third_party/include/ndpi_patricia.h"
#include "third_party/include/ndpi_md5.h"
/* stun.c */
extern u_int32_t get_stun_lru_key(struct ndpi_flow_struct *flow, u_int8_t rev);
static int _ndpi_debug_callbacks = 0;
/* #define DGA_DEBUG 1 */
+4 -3
View File
@@ -27,7 +27,7 @@
#include "ndpi_api.h"
/* stun.c */
extern u_int32_t get_stun_lru_key(struct ndpi_flow_struct *flow);
extern u_int32_t get_stun_lru_key(struct ndpi_flow_struct *flow, u_int8_t rev);
/* https://support.google.com/a/answer/1279090?hl=en */
#define HANGOUT_UDP_LOW_PORT 19302
@@ -88,8 +88,9 @@ void ndpi_search_hangout(struct ndpi_detection_module_struct *ndpi_struct,
NDPI_LOG_DBG(ndpi_struct, "search Hangout\n");
if((packet->payload_packet_len > 24) && is_google_flow(ndpi_struct, flow)) {
int matched_src = 0;
if(
((packet->udp != NULL) && (isHangoutUDPPort(ntohs(packet->udp->source))
((packet->udp != NULL) && (matched_src = isHangoutUDPPort(ntohs(packet->udp->source))
|| isHangoutUDPPort(ntohs(packet->udp->dest))))
||
((packet->tcp != NULL) && (isHangoutTCPPort(ntohs(packet->tcp->source))
@@ -101,7 +102,7 @@ void ndpi_search_hangout(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_struct->stun_cache = ndpi_lru_cache_init(1024);
if(ndpi_struct->stun_cache && flow->packet.iph && flow->packet.udp) {
u_int32_t key = get_stun_lru_key(flow);
u_int32_t key = get_stun_lru_key(flow, !matched_src);
#ifdef DEBUG_LRU
printf("[LRU] ADDING %u / %u.%u\n", key, NDPI_PROTOCOL_STUN, NDPI_PROTOCOL_HANGOUT_DUO);
-6
View File
@@ -97,12 +97,6 @@ union ja3_info {
#define TLS_THRESHOLD 34387200 /* Threshold for certificate validity */
#define TLS_LIMIT_DATE 1598918400 /* From 01/09/2020 TLS certificates lifespan is limited to 13 months */
/* skype.c */
extern u_int8_t is_skype_flow(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow);
/* stun.c */
extern u_int32_t get_stun_lru_key(struct ndpi_flow_struct *flow, u_int8_t rev);
static void ndpi_int_tls_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, u_int32_t protocol);