aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-07-15 23:53:28 +0200
committerLuca Deri <deri@ntop.org>2019-07-15 23:53:28 +0200
commitf570eccf8143a07475cbd2dd3f4fd9b7261d1298 (patch)
tree0361fb44f0e51cbf700296762555326d44f0ee80 /src
parent67dfddd0659916c9b477a09df284eff764c845f5 (diff)
Fixes #741
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c26
-rw-r--r--src/lib/protocols/hangout.c8
2 files changed, 25 insertions, 9 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 9529a8ece..43e13201a 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -3402,7 +3402,7 @@ static u_int8_t ndpi_detection_get_l4_internal(struct ndpi_detection_module_stru
#ifdef NDPI_DETECTION_SUPPORT_IPV6
else if(iph->version == 6 && l3_len >= sizeof(struct ndpi_ipv6hdr)) {
NDPI_LOG_DBG2(ndpi_struct, "ipv6 header\n");
- iph_v6 = (const struct ndpi_ipv6hdr *) iph;
+ iph_v6 = (const struct ndpi_ipv6hdr *) l3;
iph = NULL;
}
#endif
@@ -3906,11 +3906,17 @@ u_int16_t ndpi_guess_host_protocol_id(struct ndpi_detection_module_struct *ndpi_
u_int16_t ret = NDPI_PROTOCOL_UNKNOWN;
if(flow->packet.iph) {
+ struct in_addr addr;
+
+ addr.s_addr = flow->packet.iph->saddr;
+
/* guess host protocol */
- ret = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&flow->packet.iph->saddr);
+ ret = ndpi_network_ptree_match(ndpi_struct, &addr);
- if(ret == NDPI_PROTOCOL_UNKNOWN)
- ret = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&flow->packet.iph->daddr);
+ if(ret == NDPI_PROTOCOL_UNKNOWN) {
+ addr.s_addr = flow->packet.iph->daddr;
+ ret = ndpi_network_ptree_match(ndpi_struct, &addr);
+ }
}
return(ret);
@@ -4533,9 +4539,15 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct
} else {
/* guess host protocol */
if(flow->packet.iph) {
- flow->guessed_host_protocol_id = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&flow->packet.iph->saddr);
- if(flow->guessed_host_protocol_id == NDPI_PROTOCOL_UNKNOWN)
- flow->guessed_host_protocol_id = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&flow->packet.iph->daddr);
+ struct in_addr addr;
+
+ addr.s_addr = flow->packet.iph->saddr;
+ flow->guessed_host_protocol_id = ndpi_network_ptree_match(ndpi_struct, &addr);
+
+ if(flow->guessed_host_protocol_id == NDPI_PROTOCOL_UNKNOWN) {
+ addr.s_addr = flow->packet.iph->daddr;
+ flow->guessed_host_protocol_id = ndpi_network_ptree_match(ndpi_struct, &addr);
+ }
}
}
}
diff --git a/src/lib/protocols/hangout.c b/src/lib/protocols/hangout.c
index fc94aad5f..a9b63a021 100644
--- a/src/lib/protocols/hangout.c
+++ b/src/lib/protocols/hangout.c
@@ -62,8 +62,12 @@ static u_int8_t is_google_flow(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_packet_struct *packet = &flow->packet;
if(packet->iph) {
- if(google_ptree_match(ndpi_struct, (struct in_addr *)&packet->iph->saddr)
- || google_ptree_match(ndpi_struct, (struct in_addr *)&packet->iph->daddr)) {
+ struct in_addr saddr, daddr;
+
+ saddr.s_addr = packet->iph->saddr, daddr.s_addr = packet->iph->daddr;
+
+ if(google_ptree_match(ndpi_struct, &saddr)
+ || google_ptree_match(ndpi_struct, &daddr)) {
return(1);
}
}