diff options
author | Luca Deri <deri@ntop.org> | 2021-03-09 12:55:14 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-03-09 12:55:14 +0100 |
commit | 3032864ec9a647034599d343fad29f2f8fb11064 (patch) | |
tree | e3e2dbdc050aed6acc5930b9afc03b468d8a4869 /src/lib/protocols/http.c | |
parent | db716d0ab02e47ff2b0e4edc12de9fad4222d348 (diff) |
Added Ookla detection over IPv6
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r-- | src/lib/protocols/http.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index cc1d39917..443fc80f8 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -930,13 +930,24 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct if(ndpi_struct->ookla_cache == NULL) ndpi_struct->ookla_cache = ndpi_lru_cache_init(1024); - if(packet->iph != NULL && ndpi_struct->ookla_cache != NULL) { - if(packet->tcp->source == htons(8080)) - ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, packet->iph->saddr, 1 /* dummy */); - else - ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, packet->iph->daddr, 1 /* dummy */); + if(ndpi_struct->ookla_cache != NULL) { + if(packet->iph != NULL) { + if(packet->tcp->source == htons(8080)) + ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, packet->iph->saddr, 1 /* dummy */); + else + ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, packet->iph->daddr, 1 /* dummy */); + } else if(packet->iphv6 != NULL) { + u_int32_t h; + + if(packet->tcp->source == htons(8080)) + h = ndpi_quick_hash((unsigned char *)&packet->iphv6->ip6_src, sizeof(packet->iphv6->ip6_src)); + else + h = ndpi_quick_hash((unsigned char *)&packet->iphv6->ip6_dst, sizeof(packet->iphv6->ip6_dst)); + + ndpi_lru_add_to_cache(ndpi_struct->ookla_cache, h, 1 /* dummy */); + } } - + return; } |