From 032e778a6dc1ee2173c4cdb2c671180c5b5df245 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:39:10 +0200 Subject: Simplify `ndpi_internal_guess_undetected_protocol()` (#1941) `ndpi_guess_undetected_protocol()/ndpi_internal_guess_undetected_protocol()` is a strange function: * it is exported by the library and it is actively used by `ntopng` * it is intrinsecally ipv4-only * it returns basically something like "classification_by_ip"/"classification_by_port" (these information have already been calculated in `ndpi_do_guess()`...) * it access the bittorrent LRU caches (similarly to `ndpi_detection_giveup()` but without all the other caches...) So: * make the interface IPv4/6 agnostic * use the classifications already available This work will allow to make the Bittorrent caches IPV6-aware (see 81e1ea5). Handle Dropbox classification "by-port" in the "standard" way. --- fuzz/fuzz_config.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'fuzz/fuzz_config.cpp') diff --git a/fuzz/fuzz_config.cpp b/fuzz/fuzz_config.cpp index 2e0a27ff4..177266ba7 100644 --- a/fuzz/fuzz_config.cpp +++ b/fuzz/fuzz_config.cpp @@ -156,14 +156,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_get_flow_risk_info(&flow, out, sizeof(out), 1); ndpi_get_flow_ndpi_proto(ndpi_info_mod, &flow, &p2); ndpi_is_proto(p, NDPI_PROTOCOL_TLS); - /* ndpi_guess_undetected_protocol() is a "strange" function (since is ipv4 only) - but it is exported by the library and it is used by ntopng. Try fuzzing it, here */ + /* ndpi_guess_undetected_protocol() is a "strange" function. Try fuzzing it, here */ if(!ndpi_is_protocol_detected(ndpi_info_mod, p)) { + ndpi_guess_undetected_protocol(ndpi_info_mod, bool_value ? &flow : NULL, + flow.l4_proto); if(!flow.is_ipv6) { - ndpi_guess_undetected_protocol(ndpi_info_mod, bool_value ? &flow : NULL, - flow.l4_proto, - flow.c_address.v4, flow.s_address.v4, - flow.c_port, flow.s_port); /* Another "strange" function (ipv4 only): fuzz it here, for lack of a better alternative */ ndpi_find_ipv4_category_userdata(ndpi_info_mod, flow.c_address.v4); } -- cgit v1.2.3