From ef4350f8e4efecf3b054e3d3ff163da91fcffa0c Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 28 Sep 2023 01:31:27 +0200 Subject: [PATCH] dnsdist: Handle cross-protocol I/O errors for DoQ queries --- pdns/dnsdistdist/doq.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/doq.cc b/pdns/dnsdistdist/doq.cc index a90d90e5e1..894a99deda 100644 --- a/pdns/dnsdistdist/doq.cc +++ b/pdns/dnsdistdist/doq.cc @@ -193,8 +193,21 @@ public: return handleResponse(now, std::move(response)); } - void notifyIOError(const struct timeval& now, TCPResponse&& response) override + void notifyIOError([[maybe_unused]] const struct timeval& now, TCPResponse&& response) override { + if (!response.d_idstate.doqu) { + return; + } + + auto unit = std::move(response.d_idstate.doqu); + if (unit->dsc == nullptr) { + return; + } + + /* this will signal an error */ + unit->response.clear(); + unit->ids = std::move(response.d_idstate); + sendBackDOQUnit(std::move(unit), "Cross-protocol error"); } }; -- 2.47.2