diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-11-22 18:00:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 18:00:02 +0100 |
commit | afb5c3e6bad82ebd265ab12254ac7c6e067a791b (patch) | |
tree | ac21af18baab7e786d495fd03818590576b8f413 /src/lib | |
parent | 6e6f1e448967f38d15c2b83264e34f310806d555 (diff) |
Fix classification "by-port" of QUIC flows (#1785)
nDPI is able to properly classify QUIC flows only if it elaborates the
very first packets of the flow.
The protocol list in `is_udp_guessable_protocol()` is basically a list
of protocols which can be detected from *any* packets in the flow.
Rename such function to `is_udp_not_guessable_protocol()`: the name is
still quite cryptic, but at least not plainly wrong
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ndpi_main.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 285f43d2a..d66ebc786 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -3302,9 +3302,8 @@ static ndpi_default_ports_tree_node_t *ndpi_get_guessed_protocol_id(struct ndpi_ and thus that if have NOT been detected they cannot be guessed as they have been excluded */ -u_int8_t is_udp_guessable_protocol(u_int16_t l7_guessed_proto) { +u_int8_t is_udp_not_guessable_protocol(u_int16_t l7_guessed_proto) { switch(l7_guessed_proto) { - case NDPI_PROTOCOL_QUIC: case NDPI_PROTOCOL_SNMP: case NDPI_PROTOCOL_NETFLOW: /* TODO: add more protocols (if any missing) */ @@ -3330,7 +3329,7 @@ u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_str, /* We need to check if the guessed protocol isn't excluded by nDPI */ if(flow && (proto == IPPROTO_UDP) && NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, guessed_proto) && - is_udp_guessable_protocol(guessed_proto)) + is_udp_not_guessable_protocol(guessed_proto)) return(NDPI_PROTOCOL_UNKNOWN); else { *user_defined_proto = found->customUserProto; @@ -5930,7 +5929,7 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st if((guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN) && (flow->l4_proto == IPPROTO_UDP) && NDPI_ISSET(&flow->excluded_protocol_bitmask, guessed_protocol_id) && - is_udp_guessable_protocol(guessed_protocol_id)) + is_udp_not_guessable_protocol(guessed_protocol_id)) flow->guessed_protocol_id = guessed_protocol_id = NDPI_PROTOCOL_UNKNOWN; if(guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN) { @@ -7516,7 +7515,7 @@ ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct if(rc != NDPI_PROTOCOL_UNKNOWN) { if(flow && (proto == IPPROTO_UDP) && - NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, rc) && is_udp_guessable_protocol(rc)) + NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, rc) && is_udp_not_guessable_protocol(rc)) ; else { ret.app_protocol = rc, @@ -7537,7 +7536,7 @@ ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct rc = ndpi_guess_protocol_id(ndpi_str, flow, proto, sport, dport, &user_defined_proto); if(rc != NDPI_PROTOCOL_UNKNOWN) { if(flow && (proto == IPPROTO_UDP) && - NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, rc) && is_udp_guessable_protocol(rc)) + NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, rc) && is_udp_not_guessable_protocol(rc)) ; else { ret.app_protocol = rc; |