From 8cd830d7c806cac681b057e0c0185f29992fa35f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 15 Mar 2005 01:41:28 +0000 Subject: [PATCH] 1802. [bug] Handle connection resets better. [RT #11280] --- CHANGES | 2 +- lib/dns/resolver.c | 3 ++- lib/isc/unix/socket.c | 13 +++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index a31feab484..f803a20d88 100644 --- a/CHANGES +++ b/CHANGES @@ -60,7 +60,7 @@ 1803. [placeholder] rt13483 -1802. [placeholder] rt11280 +1802. [bug] Handle connection resets better. [RT #11280] 1801. [func] Report differences between hints and real NS rrset and associated address records. diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 5eaba1668b..eacbf94716 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.304 2005/03/04 03:53:21 marka Exp $ */ +/* $Id: resolver.c,v 1.305 2005/03/15 01:41:28 marka Exp $ */ #include @@ -1427,6 +1427,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { case ISC_R_CONNREFUSED: case ISC_R_NOPERM: case ISC_R_ADDRNOTAVAIL: + case ISC_R_CONNECTIONRESET: /* * No route to remote. */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index c0f045c45e..6f8eb5f08b 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.245 2005/02/24 00:33:34 marka Exp $ */ +/* $Id: socket.c,v 1.246 2005/03/15 01:41:28 marka Exp $ */ #include @@ -284,7 +284,7 @@ socket_log(isc_socket_t *sock, isc_sockaddr_t *address, const char *fmt, ...) { char msgbuf[2048]; - char peerbuf[256]; + char peerbuf[ISC_SOCKADDR_FORMATSIZE]; va_list ap; if (! isc_log_wouldlog(isc_lctx, level)) @@ -3294,6 +3294,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, ERROR_MATCH(ENOBUFS, ISC_R_NORESOURCES); ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH); ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED); + ERROR_MATCH(ECONNRESET, ISC_R_CONNECTIONRESET); #undef ERROR_MATCH } @@ -3363,6 +3364,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { int cc; ISC_SOCKADDR_LEN_T optlen; char strbuf[ISC_STRERRORSIZE]; + char peerbuf[ISC_SOCKADDR_FORMATSIZE]; UNUSED(me); INSIST(ev->ev_type == ISC_SOCKEVENT_INTW); @@ -3439,13 +3441,16 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH); ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED); ERROR_MATCH(ETIMEDOUT, ISC_R_TIMEDOUT); + ERROR_MATCH(ECONNRESET, ISC_R_CONNECTIONRESET); #undef ERROR_MATCH default: dev->result = ISC_R_UNEXPECTED; + isc_sockaddr_format(&sock->address, peerbuf, + sizeof(peerbuf)); isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_connect: connect() %s", - strbuf); + "internal_connect: connect(%s) %s", + peerbuf, strbuf); } } else { dev->result = ISC_R_SUCCESS;