mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
1845. [bug] Improve error reporting to distingish between
accept()/fcntl() and socket()/fcntl() errors. [RT #13745]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -39,7 +39,9 @@
|
|||||||
1846. [contrib] query-loc-0.3.0 from Stephane Bortzmeyer
|
1846. [contrib] query-loc-0.3.0 from Stephane Bortzmeyer
|
||||||
<bortzmeyer@nic.fr>.
|
<bortzmeyer@nic.fr>.
|
||||||
|
|
||||||
1845. [placeholder] rt13745
|
1845. [bug] Improve error reporting to distingish between
|
||||||
|
accept()/fcntl() and socket()/fcntl() errors.
|
||||||
|
[RT #13745]
|
||||||
|
|
||||||
1844. [bug] inet_pton() accepted more that 4 hexadecimal digits
|
1844. [bug] inet_pton() accepted more that 4 hexadecimal digits
|
||||||
for each 16 bit piece of the IPv6 address. The text
|
for each 16 bit piece of the IPv6 address. The text
|
||||||
|
@@ -34,7 +34,7 @@ rt13662 new
|
|||||||
rt13694 new
|
rt13694 new
|
||||||
rt13707 new
|
rt13707 new
|
||||||
rt13714 new
|
rt13714 new
|
||||||
rt13745 new
|
rt13745 closed
|
||||||
rt13753 new
|
rt13753 new
|
||||||
rt13754 new
|
rt13754 new
|
||||||
rt13771 new
|
rt13771 new
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: socket.c,v 1.249 2005/04/27 04:57:23 sra Exp $ */
|
/* $Id: socket.c,v 1.250 2005/05/19 02:42:42 marka Exp $ */
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ select_poke(isc_socketmgr_t *mgr, int fd, int msg) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} while (cc < 0 && SOFT_ERROR(errno));
|
} while (cc < 0 && SOFT_ERROR(errno));
|
||||||
|
|
||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
isc__strerror(errno, strbuf, sizeof(strbuf));
|
||||||
FATAL_ERROR(__FILE__, __LINE__,
|
FATAL_ERROR(__FILE__, __LINE__,
|
||||||
@@ -1358,6 +1358,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
int on = 1;
|
int on = 1;
|
||||||
#endif
|
#endif
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
|
const char *err = "socket";
|
||||||
|
|
||||||
REQUIRE(VALID_MANAGER(manager));
|
REQUIRE(VALID_MANAGER(manager));
|
||||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||||
@@ -1380,23 +1381,24 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef F_DUPFD
|
#ifdef F_DUPFD
|
||||||
/*
|
/*
|
||||||
* Leave a space for stdio to work in.
|
* Leave a space for stdio to work in.
|
||||||
*/
|
*/
|
||||||
if (sock->fd >= 0 && sock->fd < 20) {
|
if (sock->fd >= 0 && sock->fd < 20) {
|
||||||
int new, tmp;
|
int new, tmp;
|
||||||
new = fcntl(sock->fd, F_DUPFD, 20);
|
new = fcntl(sock->fd, F_DUPFD, 20);
|
||||||
tmp = errno;
|
tmp = errno;
|
||||||
(void)close(sock->fd);
|
(void)close(sock->fd);
|
||||||
errno = tmp;
|
errno = tmp;
|
||||||
sock->fd = new;
|
sock->fd = new;
|
||||||
}
|
err = "isc_socket_create: fcntl";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sock->fd >= (int)FD_SETSIZE) {
|
if (sock->fd >= (int)FD_SETSIZE) {
|
||||||
(void)close(sock->fd);
|
(void)close(sock->fd);
|
||||||
isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
|
isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
|
||||||
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
|
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
|
||||||
isc_msgcat, ISC_MSGSET_SOCKET,
|
isc_msgcat, ISC_MSGSET_SOCKET,
|
||||||
ISC_MSG_TOOMANYFDS,
|
ISC_MSG_TOOMANYFDS,
|
||||||
"%s: too many open file descriptors", "socket");
|
"%s: too many open file descriptors", "socket");
|
||||||
@@ -1426,7 +1428,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
default:
|
default:
|
||||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
isc__strerror(errno, strbuf, sizeof(strbuf));
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"socket() %s: %s",
|
"%s() %s: %s", err,
|
||||||
isc_msgcat_get(isc_msgcat,
|
isc_msgcat_get(isc_msgcat,
|
||||||
ISC_MSGSET_GENERAL,
|
ISC_MSGSET_GENERAL,
|
||||||
ISC_MSG_FAILED,
|
ISC_MSG_FAILED,
|
||||||
@@ -1778,6 +1780,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||||||
int fd;
|
int fd;
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
|
const char *err = "accept";
|
||||||
|
|
||||||
UNUSED(me);
|
UNUSED(me);
|
||||||
|
|
||||||
@@ -1831,17 +1834,18 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||||||
(void *)&addrlen);
|
(void *)&addrlen);
|
||||||
|
|
||||||
#ifdef F_DUPFD
|
#ifdef F_DUPFD
|
||||||
/*
|
/*
|
||||||
* Leave a space for stdio to work in.
|
* Leave a space for stdio to work in.
|
||||||
*/
|
*/
|
||||||
if (fd >= 0 && fd < 20) {
|
if (fd >= 0 && fd < 20) {
|
||||||
int new, tmp;
|
int new, tmp;
|
||||||
new = fcntl(fd, F_DUPFD, 20);
|
new = fcntl(fd, F_DUPFD, 20);
|
||||||
tmp = errno;
|
tmp = errno;
|
||||||
(void)close(fd);
|
(void)close(fd);
|
||||||
errno = tmp;
|
errno = tmp;
|
||||||
fd = new;
|
fd = new;
|
||||||
}
|
err = "fcntl";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@@ -1870,7 +1874,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||||||
}
|
}
|
||||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
isc__strerror(errno, strbuf, sizeof(strbuf));
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"internal_accept: accept() %s: %s",
|
"internal_accept: %s() %s: %s", err,
|
||||||
isc_msgcat_get(isc_msgcat,
|
isc_msgcat_get(isc_msgcat,
|
||||||
ISC_MSGSET_GENERAL,
|
ISC_MSGSET_GENERAL,
|
||||||
ISC_MSG_FAILED,
|
ISC_MSG_FAILED,
|
||||||
@@ -2211,7 +2215,7 @@ watcher(void *uap) {
|
|||||||
cc = select(maxfd, &readfds, &writefds, NULL, NULL);
|
cc = select(maxfd, &readfds, &writefds, NULL, NULL);
|
||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
if (!SOFT_ERROR(errno)) {
|
if (!SOFT_ERROR(errno)) {
|
||||||
isc__strerror(errno, strbuf,
|
isc__strerror(errno, strbuf,
|
||||||
sizeof(strbuf));
|
sizeof(strbuf));
|
||||||
FATAL_ERROR(__FILE__, __LINE__,
|
FATAL_ERROR(__FILE__, __LINE__,
|
||||||
"select() %s: %s",
|
"select() %s: %s",
|
||||||
@@ -3447,7 +3451,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) {
|
|||||||
ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
|
ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
|
||||||
ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
|
ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
|
||||||
ERROR_MATCH(ETIMEDOUT, ISC_R_TIMEDOUT);
|
ERROR_MATCH(ETIMEDOUT, ISC_R_TIMEDOUT);
|
||||||
ERROR_MATCH(ECONNRESET, ISC_R_CONNECTIONRESET);
|
ERROR_MATCH(ECONNRESET, ISC_R_CONNECTIONRESET);
|
||||||
#undef ERROR_MATCH
|
#undef ERROR_MATCH
|
||||||
default:
|
default:
|
||||||
dev->result = ISC_R_UNEXPECTED;
|
dev->result = ISC_R_UNEXPECTED;
|
||||||
@@ -3618,7 +3622,7 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
|||||||
dev->result = ISC_R_CANCELED;
|
dev->result = ISC_R_CANCELED;
|
||||||
dev->ev_sender = sock;
|
dev->ev_sender = sock;
|
||||||
isc_task_sendanddetach(¤t_task,
|
isc_task_sendanddetach(¤t_task,
|
||||||
ISC_EVENT_PTR(&dev));
|
ISC_EVENT_PTR(&dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = next;
|
dev = next;
|
||||||
|
Reference in New Issue
Block a user