aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremanuele-f <black.silver@hotmail.it>2018-10-10 10:43:51 +0200
committeremanuele-f <black.silver@hotmail.it>2018-10-10 10:43:51 +0200
commit6ff6c2e5afc13bfaa2422910817a86cc167e2c5b (patch)
treef4da130e220927c96f0d1d9df48c2d715e273f12
parentcf0c8be63d8f133cfc056e81c91f26d0bf5fa63a (diff)
Fix category field not accounted in ndpi_get_proto_category
Fixes #627
-rw-r--r--src/lib/ndpi_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 760d29a26..dc8443ee8 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -5599,8 +5599,10 @@ const char* ndpi_category_get_name(struct ndpi_detection_module_struct *ndpi_mod
ndpi_protocol_category_t ndpi_get_proto_category(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto) {
+ if(proto.category != NDPI_PROTOCOL_CATEGORY_UNSPECIFIED)
+ return proto.category;
/* simple rule: sub protocol first, master after */
- if((proto.master_protocol == NDPI_PROTOCOL_UNKNOWN) ||
+ else if((proto.master_protocol == NDPI_PROTOCOL_UNKNOWN) ||
(ndpi_mod->proto_defaults[proto.app_protocol].protoCategory != NDPI_PROTOCOL_CATEGORY_UNSPECIFIED))
return ndpi_mod->proto_defaults[proto.app_protocol].protoCategory;
else