Log format error from upstream as 'FORMERR'

Signed-off-by: Rob Gill <rrobgill@protonmail.com>

At the moment if a misformatted query is reported by the upstream server
it is not clear from the log.
Other error codes from RFC1035 (server failure, not implemented,
refused) are logged with text, but format error is logged merely as "1".

Such that an upstream reporting a format error is presently logged as eg:
Apr 20 12:01:55 dnsmasq[3023]: reply error is 1

After this patch they are logged informatively, eg:
Apr 20 12:48:40 dnsmasq[3023]: reply error is FORMERR

This is a two line fix, FORMERR is already defined in dns-protocol.h.
This commit is contained in:
Rob Gill
2025-04-20 22:38:43 +01:00
committed by Simon Kelley
parent e3a2c8dadf
commit cfa1313e1f

View File

@@ -2222,6 +2222,8 @@ void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
dest = "SERVFAIL";
else if (rcode == REFUSED)
dest = "REFUSED";
else if (rcode == FORMERR)
dest = "FORMERR";
else if (rcode == NOTIMP)
dest = "not implemented";
else