diff options
author | Luca Deri <deri@ntop.org> | 2024-05-17 16:38:02 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2024-05-17 16:38:02 +0200 |
commit | c63446e59220efd3b133bccbbd44ed97c86c78f1 (patch) | |
tree | 1566b243405aa95bf084dc1ee24792baa9abd3a6 /src/lib/ndpi_utils.c | |
parent | 33d3d254acf20fcdb1db106cdf8161e73b9e747a (diff) |
Cleaned up API
Removed
- int ndpi_load_ipv4_ptree_file(ndpi_ptree_t *tree, const char *path, u_int16_t protocol_id);
- int ndpi_load_ipv6_ptree_file(ndpi_ptree_t *tree, const char *path, u_int16_t protocol_id);
Added (it supports both IPv4 and v6)
+ int ndpi_load_ptree_file(ndpi_ptree_t *tree, const char *path, u_int16_t protocol_id);
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 9f71974c4..d20de6ef2 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -2367,12 +2367,13 @@ static u_int64_t ndpi_host_ip_risk_ptree_match(struct ndpi_detection_module_stru ndpi_prefix_t prefix; ndpi_patricia_node_t *node; - if(!ndpi_str->ip_risk_mask_ptree) + if(!ndpi_str->ip_risk_mask) return((u_int64_t)-1); /* Make sure all in network byte order otherwise compares wont work */ - ndpi_fill_prefix_v4(&prefix, pin, 32, ((ndpi_patricia_tree_t *) ndpi_str->ip_risk_mask_ptree)->maxbits); - node = ndpi_patricia_search_best(ndpi_str->ip_risk_mask_ptree, &prefix); + ndpi_fill_prefix_v4(&prefix, pin, 32, + ((ndpi_patricia_tree_t *) ndpi_str->ip_risk_mask->v4)->maxbits); + node = ndpi_patricia_search_best(ndpi_str->ip_risk_mask->v4, &prefix); if(node) return(node->value.u.uv64); @@ -2387,12 +2388,13 @@ static u_int64_t ndpi_host_ip_risk_ptree_match6(struct ndpi_detection_module_str ndpi_prefix_t prefix; ndpi_patricia_node_t *node; - if(!ndpi_str->ip_risk_mask_ptree6) + if(!ndpi_str->ip_risk_mask) return((u_int64_t)-1); /* Make sure all in network byte order otherwise compares wont work */ - ndpi_fill_prefix_v6(&prefix, pin6, 128, ((ndpi_patricia_tree_t *) ndpi_str->ip_risk_mask_ptree6)->maxbits); - node = ndpi_patricia_search_best(ndpi_str->ip_risk_mask_ptree6, &prefix); + ndpi_fill_prefix_v6(&prefix, pin6, 128, + ((ndpi_patricia_tree_t *) ndpi_str->ip_risk_mask->v6)->maxbits); + node = ndpi_patricia_search_best(ndpi_str->ip_risk_mask->v6, &prefix); if(node) return(node->value.u.uv64); |