diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2019-10-03 22:35:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-03 22:35:31 +0200 |
commit | 3180f279c8452fac55aa8785a0e0bbe23ec6a3b6 (patch) | |
tree | 67adf640a77dba672c39d2347d6f1096cabf4ae3 /src/lib/ndpi_main.c | |
parent | 1982e6cef99fab6ce21650955fea9655fe35224e (diff) | |
parent | 8897aa6acbac707b3b08cd523a497f85e5c29238 (diff) |
Merge pull request #792 from ntop/ndpi_streaming
Move Hulu and Disney+ to category match.
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 6cb706e66..d362061fe 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) { |