Some small changes (#1869)
All dissector callbacks should not be exported by the library; make static some other local functions. The callback logic in `ndpiReader` has never been used. With internal libgcrypt, `gcry_control()` should always return no errors. We can check `categories` length at compilation time.
This commit is contained in:
+7
-7
@@ -2653,6 +2653,13 @@ static const char *categories[] = {
|
||||
"Antimalware",
|
||||
};
|
||||
|
||||
#if !defined(NDPI_CFFI_PREPROCESSING) && defined(__linux__)
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
_Static_assert(sizeof(categories) / sizeof(char *) == NDPI_PROTOCOL_NUM_CATEGORIES,
|
||||
"Invalid categories length. Do you need to update 'categories' array or 'ndpi_protocol_category_t'?");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ******************************************************************** */
|
||||
|
||||
struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs prefs) {
|
||||
@@ -2815,13 +2822,6 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
|
||||
ndpi_str->risky_domain_automa.ac_automa = NULL; /* Initialized on demand */
|
||||
ndpi_str->trusted_issuer_dn = NULL;
|
||||
|
||||
if((sizeof(categories) / sizeof(char *)) != NDPI_PROTOCOL_NUM_CATEGORIES) {
|
||||
NDPI_LOG_ERR(ndpi_str, "[NDPI] invalid categories length: expected %u, got %u\n", NDPI_PROTOCOL_NUM_CATEGORIES,
|
||||
(unsigned int) (sizeof(categories) / sizeof(char *)));
|
||||
ndpi_free(ndpi_str);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ndpi_str->custom_categories.hostnames.ac_automa = ac_automata_init(ac_domain_match_handler);
|
||||
if(!ndpi_str->custom_categories.hostnames.ac_automa) {
|
||||
ndpi_exit_detection_module(ndpi_str);
|
||||
|
||||
Reference in New Issue
Block a user