aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2022-01-15 17:35:06 +0100
committerGitHub <noreply@github.com>2022-01-15 17:35:06 +0100
commit63c44a24b63e9f015ae0f114dcfd821f245c2070 (patch)
treea95fd93950feece506b22492b945d1a2ead3eb0a /src/lib/protocols
parent20b5f6d7ccec517cf7455911040d114d8c2eba29 (diff)
STUN: fix "confidence" value for some classifications (#1407)
Diffstat (limited to 'src/lib/protocols')
-rw-r--r--src/lib/protocols/stun.c12
1 files changed, 8 insertions, 4 deletions
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 */