From cfa1313e1ff0bb4c25e18a16ec132458dad11fa1 Mon Sep 17 00:00:00 2001 From: Rob Gill Date: Sun, 20 Apr 2025 22:38:43 +0100 Subject: [PATCH] Log format error from upstream as 'FORMERR' Signed-off-by: Rob Gill 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. --- src/cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cache.c b/src/cache.c index d394112..1bd1a22 100644 --- a/src/cache.c +++ b/src/cache.c @@ -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