From 678dd61866944eae011fa96f1c6d39d0c201858e Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Fri, 9 Sep 2022 20:17:17 +0200 Subject: 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. --- src/lib/protocols/hangout.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/protocols/hangout.c') diff --git a/src/lib/protocols/hangout.c b/src/lib/protocols/hangout.c index 3c463bbc6..7f5414ef0 100644 --- a/src/lib/protocols/hangout.c +++ b/src/lib/protocols/hangout.c @@ -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); -- cgit v1.2.3