Various STUN improvements

This commit is contained in:
Luca Deri
2019-09-17 00:11:17 +02:00
parent 8f4e8d8254
commit 64ed0ac6b3
3 changed files with 78 additions and 41 deletions
+7 -5
View File
@@ -1329,16 +1329,18 @@ void ndpi_search_tls_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
flow->guessed_protocol_id = NDPI_PROTOCOL_TLS;
if(flow->protos.stun_ssl.stun.num_udp_pkts > 0) {
u_int32_t key = get_stun_lru_key(flow, 1);
if(ndpi_struct->stun_cache == NULL)
ndpi_struct->stun_cache = ndpi_lru_cache_init(1024);
ndpi_lru_add_to_cache(ndpi_struct->stun_cache, key, NDPI_PROTOCOL_SIGNAL);
if(ndpi_struct->stun_cache) {
#ifdef DEBUG_TLS
printf("[LRU] Adding Signal cached key %u\n", key);
printf("[LRU] Adding Signal cached keys\n");
#endif
ndpi_lru_add_to_cache(ndpi_struct->stun_cache, get_stun_lru_key(flow, 0), NDPI_PROTOCOL_SIGNAL);
ndpi_lru_add_to_cache(ndpi_struct->stun_cache, get_stun_lru_key(flow, 1), NDPI_PROTOCOL_SIGNAL);
}
/* In Signal protocol STUN turns into DTLS... */
ndpi_int_tls_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_SIGNAL);
} else if(flow->protos.stun_ssl.ssl.ja3_server[0] != '\0') {