aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLeonn Paiva <leonn.paiva@gmail.com>2020-04-22 03:48:12 -0300
committerLeonn Paiva <leonn.paiva@gmail.com>2020-04-22 03:48:12 -0300
commit6769168d8912d80c1343945232bffb8adc8f74b2 (patch)
tree6fc1b298e761880a081da3489e842eced364e2ab /src
parent4d5ca2c473242c65a2bf87a1f0350ccb54fe231b (diff)
:bug: use protocol_was_guessed in ndpi_detection_giveup
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 445a9b22e..cb1f951ac 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -4125,10 +4125,13 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
goto check_stun_export;
else if ((flow->guessed_protocol_id == NDPI_PROTOCOL_HANGOUT_DUO) ||
(flow->guessed_protocol_id == NDPI_PROTOCOL_MESSENGER) ||
- (flow->guessed_protocol_id == NDPI_PROTOCOL_WHATSAPP_CALL))
+ (flow->guessed_protocol_id == NDPI_PROTOCOL_WHATSAPP_CALL)) {
+ *protocol_was_guessed = 1;
ndpi_set_detected_protocol(ndpi_str, flow, flow->guessed_protocol_id, NDPI_PROTOCOL_UNKNOWN);
+ }
else if ((flow->l4.tcp.tls.hello_processed == 1) &&
(flow->protos.stun_ssl.ssl.client_requested_server_name[0] != '\0')) {
+ *protocol_was_guessed = 1;
ndpi_set_detected_protocol(ndpi_str, flow, NDPI_PROTOCOL_TLS, NDPI_PROTOCOL_UNKNOWN);
} else if (enable_guess) {
if ((flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN) && (flow->packet.l4_protocol == IPPROTO_TCP) &&
@@ -4169,18 +4172,25 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
guessed_host_protocol_id = ret_match.protocol_id;
}
+ *protocol_was_guessed = 1;
ndpi_int_change_protocol(ndpi_str, flow, guessed_host_protocol_id, guessed_protocol_id);
}
}
} else if (enable_guess) {
- if (flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN)
+ if (flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
+ *protocol_was_guessed = 1;
flow->detected_protocol_stack[1] = flow->guessed_protocol_id;
+ }
- if (flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN)
+ if (flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
+ *protocol_was_guessed = 1;
flow->detected_protocol_stack[0] = flow->guessed_host_protocol_id;
+ }
- if (flow->detected_protocol_stack[1] == flow->detected_protocol_stack[0])
+ if (flow->detected_protocol_stack[1] == flow->detected_protocol_stack[0]) {
+ *protocol_was_guessed = 1;
flow->detected_protocol_stack[1] = flow->guessed_host_protocol_id;
+ }
}
if ((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) &&
@@ -4188,6 +4198,7 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
check_stun_export:
if (flow->protos.stun_ssl.stun.num_processed_pkts || flow->protos.stun_ssl.stun.num_udp_pkts) {
// if(/* (flow->protos.stun_ssl.stun.num_processed_pkts >= NDPI_MIN_NUM_STUN_DETECTION) */
+ *protocol_was_guessed = 1;
ndpi_set_detected_protocol(ndpi_str, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_STUN);
}
}
@@ -4199,16 +4210,18 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st
ret.app_protocol = NDPI_PROTOCOL_MESSENGER;
else if (ret.app_protocol == NDPI_PROTOCOL_GOOGLE) {
/*
- As Google has recently introduced Duo,
- we need to distinguish between it and hangout
- thing that should be handled by the STUN dissector
- */
+ As Google has recently introduced Duo,
+ we need to distinguish between it and hangout
+ thing that should be handled by the STUN dissector
+ */
ret.app_protocol = NDPI_PROTOCOL_HANGOUT_DUO;
}
}
- if (ret.app_protocol != NDPI_PROTOCOL_UNKNOWN)
+ if (ret.app_protocol != NDPI_PROTOCOL_UNKNOWN) {
+ *protocol_was_guessed = 1;
ndpi_fill_protocol_category(ndpi_str, flow, &ret);
+ }
return (ret);
}