Commit e710c216 authored by Michael Graff's avatar Michael Graff
Browse files

check for more expected error values in connect() case

parent 6e5fa98d
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.165 2000/09/07 01:59:57 explorer Exp $ */
/* $Id: socket.c,v 1.166 2000/09/21 21:30:27 explorer Exp $ */
#include <config.h>
......@@ -970,13 +970,13 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
return (DOIO_HARD); \
}
SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
SOFT_OR_HARD(EACCES, ISC_R_NOPERM);
SOFT_OR_HARD(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(EPERM, ISC_R_HOSTUNREACH);
ALWAYS_HARD(EPIPE, ISC_R_NOTCONNECTED);
......@@ -2771,15 +2771,17 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
goto queue;
switch (errno) {
case ECONNREFUSED:
dev->result = ISC_R_CONNREFUSED;
goto err_exit;
case ENETUNREACH:
dev->result = ISC_R_NETUNREACH;
goto err_exit;
case EHOSTUNREACH:
dev->result = ISC_R_HOSTUNREACH;
goto err_exit;
#define ERROR_MATCH(a, b) case a: dev->result = b; goto err_exit;
ERROR_MATCH(EACCES, ISC_R_NOPERM);
ERROR_MATCH(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ERROR_MATCH(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
ERROR_MATCH(ECONNREFUSED, ISC_R_CONNREFUSED);
ERROR_MATCH(EHOSTUNREACH, ISC_R_HOSTUNREACH);
ERROR_MATCH(ENETUNREACH, ISC_R_NETUNREACH);
ERROR_MATCH(ENOBUFS, ISC_R_NORESOURCES);
ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
#undef ERROR_MATCH
}
sock->connected = 0;
......@@ -2908,15 +2910,18 @@ internal_connect(isc_task_t *me, isc_event_t *ev) {
* Translate other errors into ISC_R_* flavors.
*/
switch (errno) {
case ETIMEDOUT:
dev->result = ISC_R_TIMEDOUT;
break;
case ECONNREFUSED:
dev->result = ISC_R_CONNREFUSED;
break;
case ENETUNREACH:
dev->result = ISC_R_NETUNREACH;
break;
#define ERROR_MATCH(a, b) case a: dev->result = b;
ERROR_MATCH(EACCES, ISC_R_NOPERM);
ERROR_MATCH(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ERROR_MATCH(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
ERROR_MATCH(ECONNREFUSED, ISC_R_CONNREFUSED);
ERROR_MATCH(EHOSTUNREACH, ISC_R_HOSTUNREACH);
ERROR_MATCH(ENETUNREACH, ISC_R_NETUNREACH);
ERROR_MATCH(ENOBUFS, ISC_R_NORESOURCES);
ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
ERROR_MATCH(ETIMEDOUT, ISC_R_TIMEDOUT);
#undef ERROR_MATCH
default:
dev->result = ISC_R_UNEXPECTED;
UNEXPECTED_ERROR(__FILE__, __LINE__,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment