[Dnsmasq-discuss] [Patch] Logging NXDOMAIN responses when --no-negcache is enabled

Nicholas Mu nhmu at alumni.cmu.edu
Fri Nov 6 23:35:15 GMT 2020


Hi,

Attached a patch for the described issue.

Thanks,
Nick



On Mon, Sep 28, 2020 at 1:25 PM Nicholas Mu <nhmu at alumni.cmu.edu> wrote:

> Hi,
>
> I have a use case where I'd like to log queries (--log-queries) and
> disable negative caching (--no-negcache). One issue I found is that when
> using --no-negcache, dnsmasq no longer logs NXDomain responses. Digging
> through the code, it looks like as part of the dns cache insertion we will
> log the response of a query. As such if the cache insertion is never
> executed for negative responses (i.e --no-negcache), then the response is
> not logged. Is this the intended behavior/Can this functionality be added?
>
> I would like to have the NXDOMAIN in the logs as I would like to
> differentiate between NXDOMAIN responses and failing to receive a response.
>
> Without --no-negcache:
> Sep 28 13:09:36 dnsmasq[73688]: query[A] doesnotexist54321 from 127.0.0.1
> Sep 28 13:09:36 dnsmasq[73688]: forwarded doesnotexist54321 to
> 172.16.153.81
> Sep 28 13:09:36 dnsmasq[73688]: reply doesnotexist54321 is NXDOMAIN
>
> With --no-negcache:
> Sep 28 13:10:24 dnsmasq[74398]: query[A] doesnotexist54321 from 127.0.0.1
> Sep 28 13:10:24 dnsmasq[74398]: forwarded doesnotexist54321 to
> 172.16.153.81
>
> Thanks,
> Nick
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20201106/64dca328/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-NXDomain-responses-to-be-logged-even-when-no-n.patch
Type: application/octet-stream
Size: 3133 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20201106/64dca328/attachment.obj>


More information about the Dnsmasq-discuss mailing list