aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
authorRavi Kerur <ravi.kerur@viasat.com>2019-10-02 20:03:18 -0700
committerRavi Kerur <ravi.kerur@viasat.com>2019-10-02 20:03:18 -0700
commit8897aa6acbac707b3b08cd523a497f85e5c29238 (patch)
treec7410b1749fea8bb0a745f1b2887067dba57bb17 /src/lib/ndpi_main.c
parentc247a9d1919d84ba6f781e656e837baaa9cfc386 (diff)
Move Hulu and Disney+ to category match.
Signed-off-by: Ravi Kerur <ravi.kerur@viasat.com>
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index fa2192472..d346ce549 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -4234,7 +4234,6 @@ void ndpi_load_ip_category(struct ndpi_detection_module_struct *ndpi_str,
char *ptr = strrchr(ip_address_and_mask, '/');
if(ptr) {
- ptr[0] = '\0';
ptr++;
if(atoi(ptr)>=0 && atoi(ptr)<=32)
bits = atoi(ptr);
@@ -4304,13 +4303,20 @@ int ndpi_load_hostname_category(struct ndpi_detection_module_struct *ndpi_str,
/* ********************************************************************************* */
int ndpi_enable_loaded_categories(struct ndpi_detection_module_struct *ndpi_str) {
- int i;
+ int i, ip_addr[4];
/* First add the nDPI known categories matches */
- for(i=0; category_match[i].string_to_match != NULL; i++)
- ndpi_load_hostname_category(ndpi_str,
- category_match[i].string_to_match,
- category_match[i].protocol_category);
+ for(i=0; category_match[i].string_to_match != NULL; i++) {
+ if(sscanf(category_match[i].string_to_match, "%d.%d.%d.%d", &ip_addr[0], &ip_addr[1], &ip_addr[2], &ip_addr[3]) == 4){
+ ndpi_load_ip_category(ndpi_str,
+ category_match[i].string_to_match,
+ category_match[i].protocol_category);
+ } else{
+ ndpi_load_hostname_category(ndpi_str,
+ category_match[i].string_to_match,
+ category_match[i].protocol_category);
+ }
+ }
#ifdef HAVE_HYPERSCAN
if(ndpi_str->custom_categories.num_to_load > 0) {