diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-01-11 15:23:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 15:23:39 +0100 |
commit | 3a087e951d96f509c75344ad6791591e10e4f1cd (patch) | |
tree | e1c83179768f1445610bf060917700f17fce908f /src/lib/protocols/jabber.c | |
parent | a2916d2e4c19aff56979b1dafa7edd0c7d3c17fe (diff) |
Add a "confidence" field about the reliability of the classification. (#1395)
As a general rule, the higher the confidence value, the higher the
"reliability/precision" of the classification.
In other words, this new field provides an hint about "how" the flow
classification has been obtained.
For example, the application may want to ignore classification "by-port"
(they are not real DPI classifications, after all) or give a second
glance at flows classified via LRU caches (because of false positives).
Setting only one value for the confidence field is a bit tricky: more
work is probably needed in the next future to tweak/fix/improve the logic.
Diffstat (limited to 'src/lib/protocols/jabber.c')
-rw-r--r-- | src/lib/protocols/jabber.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/protocols/jabber.c b/src/lib/protocols/jabber.c index 609771c75..a5e5a069e 100644 --- a/src/lib/protocols/jabber.c +++ b/src/lib/protocols/jabber.c @@ -41,9 +41,9 @@ static struct jabber_string jabber_strings[] = { static void ndpi_int_jabber_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, - u_int32_t protocol) + u_int32_t protocol, ndpi_confidence_t confidence) { - ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN); + ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN, confidence); } static void check_content_type_and_change_protocol(struct ndpi_detection_module_struct *ndpi_struct, @@ -56,7 +56,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ for(i=0; jabber_strings[i].string != NULL; i++) { if(ndpi_strnstr((const char*)&packet->payload[x], jabber_strings[i].string, left) != NULL) { - ndpi_int_jabber_add_connection(ndpi_struct, flow, jabber_strings[i].ndpi_protocol); + ndpi_int_jabber_add_connection(ndpi_struct, flow, jabber_strings[i].ndpi_protocol, NDPI_CONFIDENCE_DPI); return; } } @@ -97,7 +97,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st NDPI_LOG_INFO(ndpi_struct, "found jabber file transfer\n"); ndpi_int_jabber_add_connection(ndpi_struct, flow, - NDPI_PROTOCOL_JABBER); + NDPI_PROTOCOL_JABBER, NDPI_CONFIDENCE_DPI_SRC_DST_ID); } } if (dst != NULL && dst->jabber_file_transfer_port[0] != 0) { @@ -117,7 +117,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st NDPI_LOG_INFO(ndpi_struct, "found jabber file transfer\n"); ndpi_int_jabber_add_connection(ndpi_struct, flow, - NDPI_PROTOCOL_JABBER); + NDPI_PROTOCOL_JABBER, NDPI_CONFIDENCE_DPI_SRC_DST_ID); } } return; @@ -274,7 +274,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st || ndpi_strnstr((const char *)&packet->payload[13], "xmlns:stream=\"http://etherx.jabber.org/streams\"", start)) { /* Protocol family */ - ndpi_int_jabber_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_JABBER); + ndpi_int_jabber_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_JABBER, NDPI_CONFIDENCE_DPI); /* search for subprotocols */ check_content_type_and_change_protocol(ndpi_struct, flow, 13); |