From 7d82948bd19c53043afe9638f749ebdde25d43b6 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sat, 10 Dec 2016 19:30:42 +0100 Subject: Improvement on ndpi_int_change_protocol() accuracy --- src/lib/ndpi_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 0e1e05bed..f457bedd1 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -4144,11 +4144,17 @@ void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t upper_detected_protocol, u_int16_t lower_detected_protocol) { + if((upper_detected_protocol == NDPI_PROTOCOL_UNKNOWN) + && (lower_detected_protocol != NDPI_PROTOCOL_UNKNOWN)) + upper_detected_protocol = lower_detected_protocol; + if(upper_detected_protocol == lower_detected_protocol) lower_detected_protocol = NDPI_PROTOCOL_UNKNOWN; - - ndpi_int_change_flow_protocol(ndpi_struct, flow, upper_detected_protocol, lower_detected_protocol); - ndpi_int_change_packet_protocol(ndpi_struct, flow, upper_detected_protocol, lower_detected_protocol); + + ndpi_int_change_flow_protocol(ndpi_struct, flow, + upper_detected_protocol, lower_detected_protocol); + ndpi_int_change_packet_protocol(ndpi_struct, flow, + upper_detected_protocol, lower_detected_protocol); } -- cgit v1.2.3