[Dnsmasq-discuss] [PATCH] Log format error from upstream as 'FORMERR' [1/1]
Rob Gill
rrobgill at protonmail.com
Sun Apr 20 18:42:30 UTC 2025
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.
---------------------------
Subject: [PATCH] Log format error from upstream as 'FORMERR'
Signed-off-by: Rob Gill <rrobgill at protonmail.com>
---
src/cache.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/cache.c b/src/cache.c
index 94f19a5..3f9316a 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -2218,6 +2218,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
--
2.25.1
---------------------------
More information about the Dnsmasq-discuss
mailing list