aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-07-31 07:44:43 +0200
committerGitHub <noreply@github.com>2023-07-31 07:44:43 +0200
commit5019022e13ac1f807d818ab4c8d6aafc1bd7d66d (patch)
treef05b991e4ba97b505f25c1cc10ac959d75df96c3 /example/ndpiReader.c
parentd477da997fb3326104037db02094f80f5e5cbe11 (diff)
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
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 260d956d5..7856ae1a0 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -1779,6 +1779,8 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
if(flow->flow_extra_info[0] != '\0') fprintf(out, "[%s]", flow->flow_extra_info);
+ if(flow->dns.geolocation_iata_code[0] != '\0') fprintf(out, "[GeoLocation: %s]", flow->dns.geolocation_iata_code);
+
if((flow->src2dst_packets+flow->dst2src_packets) > 5) {
if(flow->iat_c_to_s && flow->iat_s_to_c) {
float data_ratio = ndpi_data_ratio(flow->src2dst_bytes, flow->dst2src_bytes);