aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2018-11-29 08:44:41 +0100
committerLuca <deri@ntop.org>2018-11-29 08:44:41 +0100
commitc09284ba276a3caf9dd4a8d9440e35e2808d5551 (patch)
tree9b5b82ceca28b6f89ef37f73069e2c624cee1fca /src/lib/ndpi_main.c
parent622519e90ec2327ce8507783fb3858397bd42c07 (diff)
Improved heuristics
Used the host guessed protocol if upper protocol has not been detected
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 00707cd8a..0812e63ac 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -5179,6 +5179,15 @@ void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
if(upper_detected_protocol == lower_detected_protocol)
lower_detected_protocol = NDPI_PROTOCOL_UNKNOWN;
+ if((upper_detected_protocol != NDPI_PROTOCOL_UNKNOWN)
+ && (lower_detected_protocol == NDPI_PROTOCOL_UNKNOWN)) {
+ if((flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN)
+ && (upper_detected_protocol != flow->guessed_host_protocol_id)) {
+ lower_detected_protocol = upper_detected_protocol;
+ upper_detected_protocol = flow->guessed_host_protocol_id;
+ }
+ }
+
ndpi_int_change_flow_protocol(ndpi_struct, flow,
upper_detected_protocol, lower_detected_protocol);
ndpi_int_change_packet_protocol(ndpi_struct, flow,