mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
1536. [bug] Windows socket code failed to log a error description
when returning ISC_R_UNEXPECTED. [RT #9998]
This commit is contained in:
parent
37225662b6
commit
5e41884b4a
3
CHANGES
3
CHANGES
@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
1537. [placeholder] rt9989
|
1537. [placeholder] rt9989
|
||||||
|
|
||||||
1536. [placeholder] rt9998
|
1536. [bug] Windows socket code failed to log a error description
|
||||||
|
when returning ISC_R_UNEXPECTED. [RT #9998]
|
||||||
|
|
||||||
1535. [bug] When parsing APL records it was possible to silently
|
1535. [bug] When parsing APL records it was possible to silently
|
||||||
accept out of range ADDRESSFAMILY values. [RT# 9979]
|
accept out of range ADDRESSFAMILY values. [RT# 9979]
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: socket.c,v 1.24 2003/10/03 06:12:34 marka Exp $ */
|
/* $Id: socket.c,v 1.25 2004/01/05 08:14:56 marka Exp $ */
|
||||||
|
|
||||||
/* This code has been rewritten to take advantage of Windows Sockets
|
/* This code has been rewritten to take advantage of Windows Sockets
|
||||||
* I/O Completion Ports and Events. I/O Completion Ports is ONLY
|
* I/O Completion Ports and Events. I/O Completion Ports is ONLY
|
||||||
@ -806,11 +806,17 @@ socket_event_add(isc_socket_t *sock, long type) {
|
|||||||
hEvent = WSACreateEvent();
|
hEvent = WSACreateEvent();
|
||||||
if (hEvent == WSA_INVALID_EVENT) {
|
if (hEvent == WSA_INVALID_EVENT) {
|
||||||
stat = WSAGetLastError();
|
stat = WSAGetLastError();
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__, "WSACreateEvent: %s",
|
||||||
|
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||||
|
ISC_MSG_FAILED, "failed"));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
if (WSAEventSelect(sock->fd, hEvent, type) != 0) {
|
if (WSAEventSelect(sock->fd, hEvent, type) != 0) {
|
||||||
stat = WSAGetLastError();
|
stat = WSAGetLastError();
|
||||||
WSACloseEvent(hEvent);
|
WSACloseEvent(hEvent);
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__, "WSAEventSelect: %s",
|
||||||
|
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||||
|
ISC_MSG_FAILED, "failed"));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
sock->hEvent = hEvent;
|
sock->hEvent = hEvent;
|
||||||
@ -1072,9 +1078,14 @@ connection_reset_fix(SOCKET fd) {
|
|||||||
&dwBytesReturned, NULL, NULL);
|
&dwBytesReturned, NULL, NULL);
|
||||||
if (status != SOCKET_ERROR)
|
if (status != SOCKET_ERROR)
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
else
|
else {
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
|
"WSAIoctl(SIO_UDP_CONNRESET, oldBehaviour) %s",
|
||||||
|
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||||
|
ISC_MSG_FAILED, "failed"));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct an iov array and attach it to the msghdr passed in. This is
|
* Construct an iov array and attach it to the msghdr passed in. This is
|
||||||
@ -1786,7 +1797,7 @@ isc_result_t
|
|||||||
isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||||
isc_socket_t **socketp) {
|
isc_socket_t **socketp) {
|
||||||
isc_socket_t *sock = NULL;
|
isc_socket_t *sock = NULL;
|
||||||
isc_result_t ret;
|
isc_result_t result;
|
||||||
#if defined(USE_CMSG) || defined(SO_BSDCOMPAT)
|
#if defined(USE_CMSG) || defined(SO_BSDCOMPAT)
|
||||||
int on = 1;
|
int on = 1;
|
||||||
#endif
|
#endif
|
||||||
@ -1796,18 +1807,19 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
REQUIRE(VALID_MANAGER(manager));
|
REQUIRE(VALID_MANAGER(manager));
|
||||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||||
|
|
||||||
ret = allocate_socket(manager, type, &sock);
|
result = allocate_socket(manager, type, &sock);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (ret);
|
return (result);
|
||||||
|
|
||||||
sock->pf = pf;
|
sock->pf = pf;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case isc_sockettype_udp:
|
case isc_sockettype_udp:
|
||||||
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
|
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
if (connection_reset_fix(sock->fd) != ISC_R_SUCCESS) {
|
result = connection_reset_fix(sock->fd);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
closesocket(sock->fd);
|
closesocket(sock->fd);
|
||||||
free_socket(&sock);
|
free_socket(&sock);
|
||||||
return (ISC_R_UNEXPECTED);
|
return (result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case isc_sockettype_tcp:
|
case isc_sockettype_tcp:
|
||||||
@ -1842,9 +1854,10 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
|
result = make_nonblock(sock->fd);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
free_socket(&sock);
|
free_socket(&sock);
|
||||||
return (ISC_R_UNEXPECTED);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2125,10 +2138,14 @@ internal_accept(isc_socket_t *sock, int accept_errno) {
|
|||||||
|
|
||||||
UNLOCK(&sock->lock);
|
UNLOCK(&sock->lock);
|
||||||
|
|
||||||
if (fd != INVALID_SOCKET && (make_nonblock(fd) != ISC_R_SUCCESS)) {
|
if (fd != INVALID_SOCKET) {
|
||||||
|
isc_result_t tresult;
|
||||||
|
tresult = make_nonblock(fd);
|
||||||
|
if (tresult != ISC_R_SUCCESS)) {
|
||||||
closesocket(fd);
|
closesocket(fd);
|
||||||
fd = INVALID_SOCKET;
|
fd = INVALID_SOCKET;
|
||||||
result = ISC_R_UNEXPECTED;
|
result = tresult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2569,6 +2586,7 @@ event_wait(void *uap) {
|
|||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"event_wait: WSAEnumNetworkEvents() %s",
|
"event_wait: WSAEnumNetworkEvents() %s",
|
||||||
strbuf);
|
strbuf);
|
||||||
|
/* XXXMPA */
|
||||||
}
|
}
|
||||||
|
|
||||||
if(NetworkEvents.lNetworkEvents == 0 ) {
|
if(NetworkEvents.lNetworkEvents == 0 ) {
|
||||||
@ -2610,6 +2628,7 @@ isc_result_t
|
|||||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||||
isc_socketmgr_t *manager;
|
isc_socketmgr_t *manager;
|
||||||
events_thread_t *evthread = NULL;
|
events_thread_t *evthread = NULL;
|
||||||
|
isc_result_t result;
|
||||||
|
|
||||||
REQUIRE(managerp != NULL && *managerp == NULL);
|
REQUIRE(managerp != NULL && *managerp == NULL);
|
||||||
|
|
||||||
@ -2650,10 +2669,11 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
|||||||
/*
|
/*
|
||||||
* Start up the initial event wait thread.
|
* Start up the initial event wait thread.
|
||||||
*/
|
*/
|
||||||
if (event_thread_create(&evthread, manager) != ISC_R_SUCCESS) {
|
result = event_thread_create(&evthread, manager);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
DESTROYLOCK(&manager->lock);
|
DESTROYLOCK(&manager->lock);
|
||||||
isc_mem_put(mctx, manager, sizeof(*manager));
|
isc_mem_put(mctx, manager, sizeof(*manager));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
manager->prime_alert = evthread->sockev_list.aEventList[0];
|
manager->prime_alert = evthread->sockev_list.aEventList[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user