From e0409fb01f34596124a89c74d7723b5101ba571a Mon Sep 17 00:00:00 2001 From: Brad House Date: Fri, 8 Nov 2024 07:34:02 -0500 Subject: [PATCH] rewrite EBADRESP to EBADQUERY on ares_send Due to the way record duplication works, we might sometimes get a misleading error code. Rewrite the error code to make better sense. Authored-By: Brad House (@bradh352) --- src/lib/ares_send.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ares_send.c b/src/lib/ares_send.c index ca178a17..6efa9580 100644 --- a/src/lib/ares_send.c +++ b/src/lib/ares_send.c @@ -153,6 +153,11 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server, /* Duplicate Query */ status = ares_dns_record_duplicate_ex(&query->query, dnsrec); if (status != ARES_SUCCESS) { + /* Sometimes we might get a EBADRESP response from duplicate due to + * the way it works (write and parse), rewrite it to EBADQUERY. */ + if (status == ARES_EBADRESP) { + status = ARES_EBADQUERY; + } ares_free(query); callback(arg, status, 0, NULL); return status;