diff options
author | Andrea Buscarinu <seven.and@gmail.com> | 2015-05-21 21:31:14 +0200 |
---|---|---|
committer | Andrea Buscarinu <seven.and@gmail.com> | 2015-05-21 21:31:14 +0200 |
commit | 12ac63684b3597ca9ce02ce121f48b273b61d24e (patch) | |
tree | 59531c083bcd97f1eafb31c43d0cbb31a66a3f54 /src/lib/ndpi_main.c | |
parent | 57926cc97da148a593f08191d09e3003427a8712 (diff) | |
parent | de03e1efe4903dbcda84a8a2491cc9e1eeef210b (diff) |
Merge pull request #1 from ntop/dev
Update from original
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index b7ba63330..d8047825b 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -49,8 +49,8 @@ #endif #include "ndpi_content_match.c.inc" -#include "third_party/include/patricia.h" -#include "third_party/src/patricia.c" +#include "third_party/include/ndpi_patricia.h" +#include "third_party/src/ndpi_patricia.c" #ifdef WIN32 /* http://social.msdn.microsoft.com/Forums/uk/vcgeneral/thread/963aac07-da1a-4612-be4a-faac3f1d65ca */ @@ -1682,6 +1682,7 @@ static int fill_prefix_v4(prefix_t *p, struct in_addr *a, int b, int mb) { if(b < 0 || b > mb) return(-1); + memset(p, 0, sizeof(prefix_t)); memcpy(&p->add.sin, a, (mb+7)/8); p->family = AF_INET; p->bitlen = b; @@ -1697,6 +1698,7 @@ u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_str prefix_t prefix; patricia_node_t *node; + pin->s_addr = ntohl(pin->s_addr); /* Make sure all in network byte order otherwise compares wont work */ fill_prefix_v4(&prefix, pin, 32, ((patricia_tree_t*)ndpi_struct->protocols_ptree)->maxbits); node = ndpi_patricia_search_best(ndpi_struct->protocols_ptree, &prefix); @@ -1760,7 +1762,7 @@ static void ndpi_init_ptree_ipv4(struct ndpi_detection_module_struct *ndpi_str, struct in_addr pin; patricia_node_t *node; - pin.s_addr = host_list[i].network; + pin.s_addr = ntohl(host_list[i].network); if((node = add_to_ptree(ptree, AF_INET, &pin, host_list[i].cidr /* bits */)) != NULL) node->value.user_value = host_list[i].value; } @@ -4226,7 +4228,7 @@ unsigned int ndpi_detection_process_packet(struct ndpi_detection_module_struct * flow->packet.tick_timestamp = d; } #else - flow->packet.tick_timestamp = current_tick_l/1000; + flow->packet.tick_timestamp = (u_int32_t)current_tick_l/1000; #endif /* parse packet */ |