From 70a72f163800dd37dca1ec586ae0a58a6cef8206 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Tue, 3 Jun 2025 09:45:46 +0200 Subject: New API to enable/disable protocols; remove `ndpi_set_protocol_detection_bitmask2()` (#2853) The main goal is not to have the bitmask depending on the total number of protocols anymore: `NDPI_INTERNAL_PROTOCOL_BITMASK` depends only on internal protocols, i.e. on `NDPI_MAX_INTERNAL_PROTOCOLS`, i.e. custom-defined protocols are not counted. See #2136 Keep the old data structure `NDPI_PROTOCOL_BITMASK` with the old semantic. Since we need to change the API (and all the application code...) anyway, simplify the API: by default all the protocols are enabled. If you need otherwise, please use `ndpi_init_detection_module_ext()` instead of `ndpi_init_detection_module()` (you can find an example in the `ndpiReader` code). To update the application code you likely only need to remove these 3 lines from your code: ``` - NDPI_PROTOCOL_BITMASK all; - NDPI_BITMASK_SET_ALL(all); - ndpi_set_protocol_detection_bitmask2(ndpi_str, &all); ``` Removed an unused field and struct definition. --- fuzz/fuzz_common_code.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'fuzz/fuzz_common_code.c') diff --git a/fuzz/fuzz_common_code.c b/fuzz/fuzz_common_code.c index 0c2febce8..47fb772af 100644 --- a/fuzz/fuzz_common_code.c +++ b/fuzz/fuzz_common_code.c @@ -37,17 +37,12 @@ void fuzz_set_alloc_callbacks_and_seed(int seed) void fuzz_init_detection_module(struct ndpi_detection_module_struct **ndpi_info_mod, struct ndpi_global_context *g_ctx) { - NDPI_PROTOCOL_BITMASK all; - if(*ndpi_info_mod == NULL) { *ndpi_info_mod = ndpi_init_detection_module(g_ctx); ndpi_set_config_u64(*ndpi_info_mod, NULL, "log.level", 3); ndpi_set_config(*ndpi_info_mod, "all", "log", "enable"); - NDPI_BITMASK_SET_ALL(all); - ndpi_set_protocol_detection_bitmask2(*ndpi_info_mod, &all); - ndpi_load_domain_suffixes(*ndpi_info_mod, "public_suffix_list.dat"); ndpi_load_categories_dir(*ndpi_info_mod, "./lists/"); ndpi_load_protocols_file(*ndpi_info_mod, "protos.txt"); -- cgit v1.2.3