aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2019-08-29 15:22:46 +0200
committerLuca <deri@ntop.org>2019-08-29 15:22:46 +0200
commit9eb1676b4bc7f7b1cf23f0f2e1082c4e2f96682a (patch)
tree24879ee48a7ecede12a7ac736e11512a11b96ee8
parent9a6f6d9fe429e1de4316b324a459db345dccfcbb (diff)
parentaea91781aa476589361e16ece6aa6c10102e0f33 (diff)
Merge branch 'dev' of https://github.com/ntop/nDPI into dev
-rw-r--r--src/include/ndpi_define.h.in2
-rw-r--r--src/include/ndpi_typedefs.h11
-rw-r--r--src/lib/protocols/mdns_proto.c5
3 files changed, 11 insertions, 7 deletions
diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in
index 4d2696073..ce4c4cc60 100644
--- a/src/include/ndpi_define.h.in
+++ b/src/include/ndpi_define.h.in
@@ -250,7 +250,7 @@
/** macro to compare 2 IPv6 addresses with each other to identify the "smaller" IPv6 address */
#define NDPI_COMPARE_IPV6_ADDRESS_STRUCTS(x,y) \
- ((((u_int64_t *)(x))[0]) < (((u_int64_t *)(y))[0]) || ( (((u_int64_t *)(x))[0]) == (((u_int64_t *)(y))[0]) && (((u_int64_t *)(x))[1]) < (((u_int64_t *)(y))[1])) )
+ ((x.u6_addr.u6_addr64[0] < y.u6_addr.u6_addr64[0]) || ((x.u6_addr.u6_addr64[0] == y.u6_addr.u6_addr64[0]) && (x.u6_addr.u6_addr64[1] < y.u6_addr.u6_addr64[1])))
#define NDPI_NUM_BITS 512
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 0db1ccf91..4e231434d 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -250,27 +250,30 @@ struct ndpi_iphdr {
/* +++++++++++++++++++++++ IPv6 header +++++++++++++++++++++++ */
/* rfc3542 */
+PACK_ON
struct ndpi_in6_addr {
union {
u_int8_t u6_addr8[16];
u_int16_t u6_addr16[8];
u_int32_t u6_addr32[4];
+ u_int64_t u6_addr64[2];
} u6_addr; /* 128-bit IP6 address */
-};
+} PACK_OFF;
+PACK_ON
struct ndpi_ip6_hdrctl {
u_int32_t ip6_un1_flow;
u_int16_t ip6_un1_plen;
u_int8_t ip6_un1_nxt;
u_int8_t ip6_un1_hlim;
-};
+} PACK_OFF;
-/* PACK_ON */
+PACK_ON
struct ndpi_ipv6hdr {
struct ndpi_ip6_hdrctl ip6_hdr;
struct ndpi_in6_addr ip6_src;
struct ndpi_in6_addr ip6_dst;
-} /* PACK_OFF */;
+} PACK_OFF;
/* +++++++++++++++++++++++ TCP header +++++++++++++++++++++++ */
diff --git a/src/lib/protocols/mdns_proto.c b/src/lib/protocols/mdns_proto.c
index 75eab720b..388376e19 100644
--- a/src/lib/protocols/mdns_proto.c
+++ b/src/lib/protocols/mdns_proto.c
@@ -121,8 +121,9 @@ void ndpi_search_mdns(struct ndpi_detection_module_struct *ndpi_struct, struct n
}
#ifdef NDPI_DETECTION_SUPPORT_IPV6
if(packet->iphv6 != NULL) {
- const u_int32_t *daddr = packet->iphv6->ip6_dst.u6_addr.u6_addr32;
- if(daddr[0] == htonl(0xff020000) /* && daddr[1] == 0 && daddr[2] == 0 && daddr[3] == htonl(0xfb) */) {
+ u_int32_t daddr_0 = packet->iphv6->ip6_dst.u6_addr.u6_addr32[0];
+
+ if(daddr_0 == htonl(0xff020000) /* && daddr[1] == 0 && daddr[2] == 0 && daddr[3] == htonl(0xfb) */) {
NDPI_LOG_INFO(ndpi_struct, "found MDNS with destination address ff02::fb\n");