2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

4024. [bug] dns_rdata_opt_first, dns_rdata_opt_next,

dns_rdata_opt_current, dns_rdata_txt_first,
                        dns_rdata_txt_next and dns_rdata_txt_current were
                        documented but not implemented.  These have now been
                        implemented.

                        dns_rdata_spf_first, dns_rdata_spf_next and
                        dns_rdata_spf_current were document but not
                        implemented.  The prototypes for these
                        functions have been removed. [RT #38068]

4023.   [bug]           win32: socket handling with explict ports and
                        invoking named with -4 was broken for some
                        configurations. [RT #38068]
This commit is contained in:
Mark Andrews
2014-12-19 11:35:07 +11:00
parent ae454ec746
commit 1e0ed0c6f5
7 changed files with 199 additions and 87 deletions

View File

@@ -391,14 +391,19 @@ sock_dump(isc_socket_t *sock) {
#if 0
isc_sockaddr_t addr;
char socktext[256];
char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_result_t result;
isc_socket_getpeername(sock, &addr);
isc_sockaddr_format(&addr, socktext, sizeof(socktext));
printf("Remote Socket: %s\n", socktext);
isc_socket_getsockname(sock, &addr);
isc_sockaddr_format(&addr, socktext, sizeof(socktext));
printf("This Socket: %s\n", socktext);
result = isc_socket_getpeername(sock, &addr);
if (result == ISC_R_SUCCESS) {
isc_sockaddr_format(&addr, socktext, sizeof(socktext));
printf("Remote Socket: %s\n", socktext);
}
result = isc_socket_getsockname(sock, &addr);
if (result == ISC_R_SUCCESS) {
isc_sockaddr_format(&addr, socktext, sizeof(socktext));
printf("This Socket: %s\n", socktext);
}
#endif
printf("\n\t\tSock Dump\n");
@@ -1671,9 +1676,6 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
REQUIRE(socketp != NULL && *socketp == NULL);
REQUIRE(type != isc_sockettype_fdwatch);
if (dup_socket != NULL)
return (ISC_R_NOTIMPLEMENTED);
#ifndef SOCK_RAW
if (type == isc_sockettype_raw)
return (ISC_R_NOTIMPLEMENTED);
@@ -1684,55 +1686,40 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
return (result);
sock->pf = pf;
#if 0
if (dup_socket == NULL) {
#endif
switch (type) {
case isc_sockettype_udp:
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
if (sock->fd != INVALID_SOCKET) {
result = connection_reset_fix(sock->fd);
if (result != ISC_R_SUCCESS) {
socket_log(__LINE__, sock,
NULL, EVENT, NULL, 0, 0,
"closed %d %d %d "
"con_reset_fix_failed",
sock->pending_recv,
sock->pending_send,
sock->references);
closesocket(sock->fd);
_set_state(sock, SOCK_CLOSED);
sock->fd = INVALID_SOCKET;
free_socket(&sock, __LINE__);
return (result);
}
switch (type) {
case isc_sockettype_udp:
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
if (sock->fd != INVALID_SOCKET) {
result = connection_reset_fix(sock->fd);
if (result != ISC_R_SUCCESS) {
socket_log(__LINE__, sock,
NULL, EVENT, NULL, 0, 0,
"closed %d %d %d "
"con_reset_fix_failed",
sock->pending_recv,
sock->pending_send,
sock->references);
closesocket(sock->fd);
_set_state(sock, SOCK_CLOSED);
sock->fd = INVALID_SOCKET;
free_socket(&sock, __LINE__);
return (result);
}
break;
case isc_sockettype_tcp:
sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
break;
#ifdef SOCK_RAW
case isc_sockettype_raw:
sock->fd = socket(pf, SOCK_RAW, 0);
#ifdef PF_ROUTE
if (pf == PF_ROUTE)
sock->bound = 1;
#endif
break;
#endif
}
#if 0
} else {
/*
* XXX: dup() is deprecated in windows, use _dup()
* instead. In future we may want to investigate
* WSADuplicateSocket().
*/
sock->fd = _dup(dup_socket->fd);
sock->dupped = 1;
sock->bound = dup_socket->bound;
}
break;
case isc_sockettype_tcp:
sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
break;
#ifdef SOCK_RAW
case isc_sockettype_raw:
sock->fd = socket(pf, SOCK_RAW, 0);
#ifdef PF_ROUTE
if (pf == PF_ROUTE)
sock->bound = 1;
#endif
break;
#endif
}
if (sock->fd == INVALID_SOCKET) {
socket_errno = WSAGetLastError();
@@ -1836,6 +1823,29 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
*socketp = sock;
iocompletionport_update(sock);
if (dup_socket) {
#ifndef ISC_ALLOW_MAPPED
isc__socket_ipv6only(sock, ISC_TRUE);
#endif
if (dup_socket->bound) {
isc_sockaddr_t local;
result = isc__socket_getsockname(dup_socket, &local);
if (result != ISC_R_SUCCESS) {
isc_socket_close(sock);
return (result);
}
result = isc__socket_bind(sock, &local,
ISC_SOCKET_REUSEADDRESS);
if (result != ISC_R_SUCCESS) {
isc_socket_close(sock);
return (result);
}
}
sock->dupped = 1;
}
/*
* Note we don't have to lock the socket like we normally would because
@@ -1865,12 +1875,8 @@ isc__socket_dup(isc_socket_t *sock, isc_socket_t **socketp) {
REQUIRE(VALID_SOCKET(sock));
REQUIRE(socketp != NULL && *socketp == NULL);
#if 1
return (ISC_R_NOTIMPLEMENTED);
#else
return (socket_create(sock->manager, sock->pf, sock->type,
socketp, sock));
#endif
}
isc_result_t