From 0703ab5ac558857319c2ed4a1673444006f915f8 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Tue, 4 Feb 2020 22:16:54 +0100 Subject: Improved DNS response decoding The first decoded address is now reported by ndpiReader --- example/reader_util.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index 2236f79d3..cf8261e05 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -966,6 +966,13 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl if(n == 0) flow->bittorent_hash[0] = '\0'; } + /* DNS */ + else if(is_ndpi_proto(flow, NDPI_PROTOCOL_DNS)) { + if(flow->ndpi_flow->protos.dns.rsp_type == 0x1) + inet_ntop(AF_INET, &flow->ndpi_flow->protos.dns.rsp_addr.ipv4, flow->info, sizeof(flow->info)); + else + inet_ntop(AF_INET6, &flow->ndpi_flow->protos.dns.rsp_addr.ipv6, flow->info, sizeof(flow->info)); + } /* MDNS */ else if(is_ndpi_proto(flow, NDPI_PROTOCOL_MDNS)) { snprintf(flow->info, sizeof(flow->info), "%s", flow->ndpi_flow->protos.mdns.answer); -- cgit v1.2.3