From: Remi Gacogne Date: Tue, 9 Mar 2021 15:59:02 +0000 (+0100) Subject: dnsdist: Better messages on TLS connection closed by the remote end X-Git-Tag: rec-4.5.0-beta1~14^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9890ea74b1f81330f181a62d3755deec333a6313;p=thirdparty%2Fpdns.git dnsdist: Better messages on TLS connection closed by the remote end --- diff --git a/pdns/tcpiohandler.cc b/pdns/tcpiohandler.cc index e4eef7bad0..7a2989c316 100644 --- a/pdns/tcpiohandler.cc +++ b/pdns/tcpiohandler.cc @@ -124,9 +124,12 @@ public: else if (error == SSL_ERROR_SYSCALL) { throw std::runtime_error("Syscall error while processing TLS connection: " + std::string(strerror(errno))); } + else if (error == SSL_ERROR_ZERO_RETURN) { + throw std::runtime_error("TLS connection closed by remote end"); + } else { if (g_verbose) { - throw std::runtime_error("Error while processing TLS connection: " + libssl_get_error_string()); + throw std::runtime_error("Error while processing TLS connection: (" + std::to_string(error) + ") " + libssl_get_error_string()); } else { throw std::runtime_error("Error while processing TLS connection: " + std::to_string(error)); } @@ -875,7 +878,7 @@ public: do { ssize_t res = gnutls_record_recv(d_conn.get(), reinterpret_cast(&buffer.at(pos)), toRead - pos); if (res == 0) { - throw std::runtime_error("Error reading from TLS connection"); + throw std::runtime_error("EOF while reading from TLS connection"); } else if (res > 0) { pos += static_cast(res); @@ -906,7 +909,7 @@ public: do { ssize_t res = gnutls_record_recv(d_conn.get(), (reinterpret_cast(buffer) + got), bufferSize - got); if (res == 0) { - throw std::runtime_error("Error reading from TLS connection"); + throw std::runtime_error("EOF while reading from TLS connection"); } else if (res > 0) { got += static_cast(res);