diff options
author | emanuele-f <black.silver@hotmail.it> | 2019-09-26 12:15:49 +0200 |
---|---|---|
committer | emanuele-f <black.silver@hotmail.it> | 2019-09-26 12:15:49 +0200 |
commit | 937dcb38eacec02cf7fc8aa6f587caf98b545a4b (patch) | |
tree | ad946083252f9a42f52e5538ab18289f06170339 /src | |
parent | 62fa0908a3fd0b3f354f420ca7259d414be3ba59 (diff) |
Fix bad protocols returned in ndpi_detection_giveup when detection is already complete
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_main.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 418ceaf2e..56031e299 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -4044,8 +4044,14 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st if(flow == NULL) return(ret); - else - ret.category = flow->category; + + /* Init defaults */ + ret.master_protocol = flow->detected_protocol_stack[1], ret.app_protocol = flow->detected_protocol_stack[0]; + ret.category = flow->category; + + /* Ensure that we don't change our mind if detection is already complete */ + if((ret.master_protocol != NDPI_PROTOCOL_UNKNOWN) && (ret.app_protocol != NDPI_PROTOCOL_UNKNOWN)) + return(ret); /* TODO: add the remaining stage_XXXX protocols */ if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) { |