ndpi_mod is now optional (albeit better to spcify it) in ndpi_domain_classify_xxx calls
This commit is contained in:
@@ -90,9 +90,12 @@ bool ndpi_domain_classify_add(struct ndpi_detection_module_struct *ndpi_str,
|
|||||||
// fprintf(stdout, "."); fflush(stdout);
|
// fprintf(stdout, "."); fflush(stdout);
|
||||||
|
|
||||||
#ifdef ENCODE_DATA
|
#ifdef ENCODE_DATA
|
||||||
out_len = ndpi_encode_domain(ndpi_str, domain, out, sizeof(out));
|
if(ndpi_str) {
|
||||||
|
out_len = ndpi_encode_domain(ndpi_str, domain, out, sizeof(out));
|
||||||
ndpi_hash_add_entry(&s->domains, out, out_len, class_id);
|
|
||||||
|
ndpi_hash_add_entry(&s->domains, out, out_len, class_id);
|
||||||
|
} else
|
||||||
|
ndpi_hash_add_entry(&s->domains, domain, strlen(domain), class_id);
|
||||||
#else
|
#else
|
||||||
ndpi_hash_add_entry(&s->domains, domain, strlen(domain), class_id);
|
ndpi_hash_add_entry(&s->domains, domain, strlen(domain), class_id);
|
||||||
#endif
|
#endif
|
||||||
@@ -167,11 +170,16 @@ bool ndpi_domain_classify_hostname(struct ndpi_detection_module_struct *ndpi_mod
|
|||||||
|
|
||||||
/* This looks like a match so let's check the hash now */
|
/* This looks like a match so let's check the hash now */
|
||||||
#ifdef ENCODE_DATA
|
#ifdef ENCODE_DATA
|
||||||
char out[256];
|
if(ndpi_mod) {
|
||||||
u_int32_t out_len = ndpi_encode_domain(ndpi_mod, item, out, sizeof(out));
|
char out[256];
|
||||||
|
u_int32_t out_len = ndpi_encode_domain(ndpi_mod, item, out, sizeof(out));
|
||||||
if(ndpi_hash_find_entry(s->domains, out, out_len, class_id) == 0)
|
|
||||||
return(true);
|
if(ndpi_hash_find_entry(s->domains, out, out_len, class_id) == 0)
|
||||||
|
return(true);
|
||||||
|
} else {
|
||||||
|
if(ndpi_hash_find_entry(s->domains, item, strlen(item), class_id) == 0)
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if(ndpi_hash_find_entry(s->domains, item, strlen(item), class_id) == 0)
|
if(ndpi_hash_find_entry(s->domains, item, strlen(item), class_id) == 0)
|
||||||
return(true);
|
return(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user