STUN: several improvements

Add detection over TCP and fix detection over IPv6.
Rename some variables since Stun dissector is no more "udp-centric".
Stun dissector should always classified the flow as `STUN` or
`STUN/Something`.
Don't touch `flow->guessed_host_protocol_id` field, which should be
always be related to "ip-classification" only.
This commit is contained in:
Nardi Ivan
2022-09-11 13:33:32 +02:00
committed by Toni
parent f44413e039
commit 678dd61866
115 changed files with 201 additions and 323 deletions
+3 -3
View File
@@ -27,7 +27,7 @@
#include "ndpi_api.h"
/* stun.c */
extern u_int32_t get_stun_lru_key(struct ndpi_packet_struct *packet, u_int8_t rev);
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
@@ -101,8 +101,8 @@ void ndpi_search_hangout(struct ndpi_detection_module_struct *ndpi_struct,
if(ndpi_struct->stun_cache == NULL)
ndpi_struct->stun_cache = ndpi_lru_cache_init(1024);
if(ndpi_struct->stun_cache && packet->iph && packet->udp) {
u_int32_t key = get_stun_lru_key(packet, !matched_src);
if(ndpi_struct->stun_cache && packet->iph) {
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);