[Dnsmasq-discuss] [PATCH] Some upstream replies not being logged
Dominik DL6ER
dl6er at dl6er.de
Fri Aug 27 09:04:19 UTC 2021
Hey Simon,
when a client makes a query for a reply type that is not cache-able
(i.e., is not one of [A, AAAA, SRV, PTR]), the reply is not mentioned
at all in the log file. This is because extract_names() calls
"continue" on the reply and logging would only have happened in
insert_cache(). A noteworthy exception to this are TXT records that are
handled in do_doctor() separately. However, client association is lost
in this place (can be seen with log-queries=extra).
The attached patch fixes this by ensuring we call log_query() also for
replies that do not enter the cache. I also moved the printing of TXT
records here so "log-queries=extra" works as expected for those, too.
----
Test 1:
$ dig SOA soa.dns.netmeister.org
> Aug 27 10:33:08 dnsmasq[1497026]: query[SOA] soa.dns.netmeister.org
> from 127.0.0.1
> Aug 27 10:33:08 dnsmasq[1497026]: forwarded soa.dns.netmeister.org to
> 127.0.0.1
> Aug 27 10:33:08 dnsmasq[1497026]: reply soa.dns.netmeister.org is
> non-cached [SOA]
The last line is only visible with my patch.
----
Test 2 (log-queries=extra):
$ dig TXT txt.dns.netmeister.org
BEFORE (note missing "1 127.0.0.1/45114" in the last two):
> Aug 27 10:35:33 dnsmasq[1497046]: 1 127.0.0.1/45114 query[TXT]
> txt.dns.netmeister.org from 127.0.0.1
> Aug 27 10:35:33 dnsmasq[1497046]: 1 127.0.0.1/45114 forwarded
> txt.dns.netmeister.org to 127.0.0.1
> Aug 27 10:35:33 dnsmasq[1497046]: reply txt.dns.netmeister.org is
> Descriptive text. Completely overloaded for all sorts of things.
> RFC1035 (1987)
> Aug 27 10:35:33 dnsmasq[1497046]: reply txt.dns.netmeister.org is
> Format: <text>
NOW:
> Aug 27 10:35:53 dnsmasq[1497049]: 1 127.0.0.1/42014 query[TXT]
> txt.dns.netmeister.org from 127.0.0.1
> Aug 27 10:35:53 dnsmasq[1497049]: 1 127.0.0.1/42014 forwarded
> txt.dns.netmeister.org to 127.0.0.1
> Aug 27 10:35:53 dnsmasq[1497049]: 1 127.0.0.1/42014 reply
> txt.dns.netmeister.org is Descriptive text. Completely overloaded for
> all sorts of things. RFC1035 (1987)
> Aug 27 10:35:53 dnsmasq[1497049]: 1 127.0.0.1/42014 reply
> txt.dns.netmeister.org is Format: <text>
Best,
Dominik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Also-log-non-cacheable-replies.patch
Type: text/x-patch
Size: 4504 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210827/2a3180e3/attachment.bin>
More information about the Dnsmasq-discuss
mailing list