From e2c62419641c521c7f8f4eb5dd1fdb8e89e3bd7e Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 20 Feb 2020 17:52:27 +0100 Subject: [PATCH] Issue #175: Include query in call_reporting dict Thanks Tom Pusateri --- ChangeLog | 2 ++ src/convert.h | 4 ++++ src/util-internal.c | 21 +++++++++++++++++++++ stubby | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 353a3401..0be3df9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ * Issue #430: Record and guard UDP max payload size with servers. * Issue #407: Run only offline-tests option with: src/test/tpkg/run-offline-only.sh (only with git checkouts). + * Issue #175: Include the packet the stub resolver sent to the + upstream the call_reporting dict. Thanks Tom Pusateri * 2019-12-20: Version 1.6.0-beta.1 * Migration of build system to cmake. Build now works on Ubuntu, diff --git a/src/convert.h b/src/convert.h index 5b66412c..6b16f757 100644 --- a/src/convert.h +++ b/src/convert.h @@ -38,6 +38,10 @@ #include "types-internal.h" #include +getdns_return_t +_getdns_wire2msg_dict_scan(struct mem_funcs *mf, + const uint8_t **wire, size_t *wire_len, getdns_dict **msg_dict); + getdns_return_t _getdns_wire2rr_dict(struct mem_funcs *mf, const uint8_t *wire, size_t wire_len, getdns_dict **rr_dict); diff --git a/src/util-internal.c b/src/util-internal.c index 52897efa..62aaf226 100644 --- a/src/util-internal.c +++ b/src/util-internal.c @@ -51,6 +51,7 @@ #include "gldns/gbuffer.h" #include "gldns/pkthdr.h" #include "dnssec.h" +#include "convert.h" getdns_return_t @@ -820,6 +821,9 @@ _getdns_create_call_reporting_dict( getdns_bindata qname; getdns_dict *netreq_debug; getdns_dict *address_debug = NULL; + getdns_dict *query_dict = NULL; + const uint8_t *wire; + size_t wire_len; assert(netreq); @@ -856,6 +860,23 @@ _getdns_create_call_reporting_dict( return NULL; } /* Stub resolver debug data */ + wire = netreq->query; + wire_len = netreq->response - netreq->query; + if (!wire) + ; /* pass */ + + else if(_getdns_wire2msg_dict_scan( + &netreq_debug->mf, &wire, &wire_len, &query_dict)) { + + getdns_dict_destroy(netreq_debug); + return NULL; + + } else if (_getdns_dict_set_this_dict( + netreq_debug, "query", query_dict)) { + + getdns_dict_destroy(netreq_debug); + return NULL; + } _getdns_sockaddr_to_dict( context, &netreq->upstream->addr, &address_debug); diff --git a/stubby b/stubby index df3be6e6..a1055566 160000 --- a/stubby +++ b/stubby @@ -1 +1 @@ -Subproject commit df3be6e68952dc6c04d2d87906f8943365e10f3f +Subproject commit a105556619d4873d20e18580cdbf877514e38405