Check for common ALPNs and set a flow risk if not known. (#1175)

* Increased risk bitmask to 64bit (instead of 32bit).
 * Removed annoying "Unknown datalink" error message for fuzzers.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2021-04-27 07:22:04 +02:00
committed by GitHub
parent d5b395f35a
commit da3e6bd61b
5 changed files with 109 additions and 18 deletions
+5 -2
View File
@@ -1776,7 +1776,10 @@ const char* ndpi_risk2str(ndpi_risk_enum risk) {
case NDPI_DESKTOP_OR_FILE_SHARING_SESSION:
return("Desktop/File Sharing Session");
case NDPI_TLS_UNCOMMON_ALPN:
return("Uncommon TLS ALPN");
default:
snprintf(buf, sizeof(buf), "%d", (int)risk);
return(buf);
@@ -2460,7 +2463,7 @@ int ndpi_hash_add_entry(ndpi_str_hash *h, char *key, u_int8_t key_len, u_int8_t
/* ******************************************************************** */
void ndpi_set_risk(struct ndpi_flow_struct *flow, ndpi_risk_enum r) {
u_int32_t v = 1 << r;
ndpi_risk v = 1ull << r;
// NDPI_SET_BIT(flow->risk, (u_int32_t)r);
flow->risk |= v;