mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-04-30 16:09:43 +00:00
Add some fuzzers to test other data structures. (#1870)
Start using a dictionary for fuzzing (see: https://llvm.org/docs/LibFuzzer.html#dictionaries). Remove some dead code. Fuzzing with debug enabled is not usually a great idea (from performance POV). Keep the code since it might be useful while debugging.
This commit is contained in:
parent
29c5cc39fb
commit
9fc724de5a
184 changed files with 436 additions and 60 deletions
|
|
@ -34,22 +34,23 @@ void fuzz_set_alloc_callbacks_and_seed(int seed)
|
|||
fuzz_set_alloc_seed(seed);
|
||||
}
|
||||
|
||||
void fuzz_init_detection_module(struct ndpi_detection_module_struct **ndpi_info_mod,
|
||||
int enable_log)
|
||||
void fuzz_init_detection_module(struct ndpi_detection_module_struct **ndpi_info_mod)
|
||||
{
|
||||
ndpi_init_prefs prefs = ndpi_enable_ja3_plus;
|
||||
NDPI_PROTOCOL_BITMASK all, debug_bitmask;
|
||||
NDPI_PROTOCOL_BITMASK all;
|
||||
|
||||
if(*ndpi_info_mod == NULL) {
|
||||
*ndpi_info_mod = ndpi_init_detection_module(prefs);
|
||||
NDPI_BITMASK_SET_ALL(all);
|
||||
ndpi_set_protocol_detection_bitmask2(*ndpi_info_mod, &all);
|
||||
|
||||
if(enable_log) {
|
||||
NDPI_BITMASK_SET_ALL(debug_bitmask);
|
||||
ndpi_set_log_level(*ndpi_info_mod, 4);
|
||||
ndpi_set_debug_bitmask(*ndpi_info_mod, debug_bitmask);
|
||||
}
|
||||
#if 0
|
||||
NDPI_PROTOCOL_BITMASK debug_bitmask;
|
||||
|
||||
NDPI_BITMASK_SET_ALL(debug_bitmask);
|
||||
ndpi_set_log_level(*ndpi_info_mod, 4);
|
||||
ndpi_set_debug_bitmask(*ndpi_info_mod, debug_bitmask);
|
||||
#endif
|
||||
|
||||
ndpi_load_protocols_file(*ndpi_info_mod, "protos.txt");
|
||||
ndpi_load_categories_file(*ndpi_info_mod, "categories.txt", NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue