From 5019022e13ac1f807d818ab4c8d6aafc1bd7d66d Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Mon, 31 Jul 2023 07:44:43 +0200 Subject: DNS: extract geolocation information, if available (#2065) The option NSID (RFC5001) is used by Google DNS to report the airport code of the metro where the DNS query is handled. This option is quite rare, but the added overhead in DNS code is pretty much zero for "normal" DNS traffic --- example/reader_util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index d8c4b23f3..7144626ca 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1228,6 +1228,8 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl /* For consistency across platforms replace :0: with :: */ ndpi_patchIPv6Address(flow->info); } + if(flow->ndpi_flow->protos.dns.geolocation_iata_code[0] != '\0') + strcpy(flow->dns.geolocation_iata_code, flow->ndpi_flow->protos.dns.geolocation_iata_code); } /* MDNS */ else if(is_ndpi_proto(flow, NDPI_PROTOCOL_MDNS)) { -- cgit v1.2.3