From: Remi Gacogne Date: Thu, 10 Jun 2021 13:41:06 +0000 (+0200) Subject: dnsdist: Fix the lack of IDState for XFR responses X-Git-Tag: dnsdist-1.7.0-alpha1~124^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b02b85c886cece78daf2459e1305427c0044af9;p=thirdparty%2Fpdns.git dnsdist: Fix the lack of IDState for XFR responses Since we now detect the end of a XFR and reset the is_XFR flag, we can't rely on it anymore to skip the insertion of the response into the ring buffer. Set the type of these responses to AXFR and use that instead. A better fix would be to make the IDState available even for XFR responses, at the cost of doing a copy, and perhaps insert an entry into the ring buffer for the last message. --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 69ecb90b43..6603a75191 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -370,7 +370,7 @@ static IOState sendQueuedResponses(std::shared_ptr& static void handleResponseSent(std::shared_ptr& state, const TCPResponse& currentResponse) { - if (state->d_isXFR) { + if (state->d_isXFR || currentResponse.d_idstate.qtype == QType::AXFR || currentResponse.d_idstate.qtype == QType::IXFR) { return; } diff --git a/pdns/dnsdistdist/dnsdist-tcp-downstream.cc b/pdns/dnsdistdist/dnsdist-tcp-downstream.cc index cb76fa6fa1..b3ad94801a 100644 --- a/pdns/dnsdistdist/dnsdist-tcp-downstream.cc +++ b/pdns/dnsdistdist/dnsdist-tcp-downstream.cc @@ -483,13 +483,16 @@ IOState TCPConnectionToBackend::handleResponse(std::shared_ptrhandleXFRResponse(clientConn, now, std::move(response)); if (done) { conn->d_usedForXFR = false; - d_clientConn->d_isXFR = false; + clientConn->d_isXFR = false; d_state = State::idle; d_clientConn.reset(); return IOState::Done;