From 63c44a24b63e9f015ae0f114dcfd821f245c2070 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Sat, 15 Jan 2022 17:35:06 +0100 Subject: STUN: fix "confidence" value for some classifications (#1407) --- src/lib/protocols/stun.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/lib/protocols/stun.c') diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c index 38df16146..3f9b21fbe 100644 --- a/src/lib/protocols/stun.c +++ b/src/lib/protocols/stun.c @@ -71,8 +71,10 @@ void ndpi_int_stun_add_connection(struct ndpi_detection_module_struct *ndpi_stru #ifdef DEBUG_LRU printf("[LRU] FOUND %u / %u: no need to cache %u.%u\n", key, cached_proto, proto, app_proto); #endif - app_proto = cached_proto, proto = NDPI_PROTOCOL_STUN; - confidence = NDPI_CONFIDENCE_DPI_CACHE; + if(app_proto != cached_proto || proto != NDPI_PROTOCOL_STUN) { + app_proto = cached_proto, proto = NDPI_PROTOCOL_STUN; + confidence = NDPI_CONFIDENCE_DPI_CACHE; + } } else { u_int32_t key_rev = get_stun_lru_key(packet, 1); @@ -81,8 +83,10 @@ void ndpi_int_stun_add_connection(struct ndpi_detection_module_struct *ndpi_stru #ifdef DEBUG_LRU printf("[LRU] FOUND %u / %u: no need to cache %u.%u\n", key_rev, cached_proto, proto, app_proto); #endif - app_proto = cached_proto, proto = NDPI_PROTOCOL_STUN; - confidence = NDPI_CONFIDENCE_DPI_CACHE; + if(app_proto != cached_proto || proto != NDPI_PROTOCOL_STUN) { + app_proto = cached_proto, proto = NDPI_PROTOCOL_STUN; + confidence = NDPI_CONFIDENCE_DPI_CACHE; + } } else { if(app_proto != NDPI_PROTOCOL_STUN) { /* No sense to add STUN, but only subprotocols */ -- cgit v1.2.3