2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 16:15:27 +00:00

1146. [func] Allow IPV6_IPV6ONLY to be set/cleared on a socket if

supported by the OS by a new function
                        isc_socket_ipv6only().
This commit is contained in:
Mark Andrews
2001-11-29 07:31:25 +00:00
parent 06a949d2ce
commit 0cfa2fb26d
4 changed files with 44 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
1146. [func] Allow IPV6_IPV6ONLY to be set/cleared on a socket if
supported by the OS by a new function
isc_socket_ipv6only().
1145. [func] "host" no longer reports a NOERROR/NODATA response
by printing nothing. [RT #2065]

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.h,v 1.54 2001/03/06 01:23:02 bwelling Exp $ */
/* $Id: socket.h,v 1.55 2001/11/29 07:31:25 marka Exp $ */
#ifndef ISC_SOCKET_H
#define ISC_SOCKET_H 1
@@ -682,6 +682,16 @@ isc_socket_gettype(isc_socket_t *sock);
isc_boolean_t
isc_socket_isbound(isc_socket_t *sock);
void
isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes);
/*
* If the socket is an IPv6 socket set/clear the IPV6_IPV6ONLY socket
* option if the host OS supports this option.
*
* Requires:
* 'sock' is a valid socket.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_SOCKET_H */

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.215 2001/11/27 01:56:19 gson Exp $ */
/* $Id: socket.c,v 1.216 2001/11/29 07:31:22 marka Exp $ */
#include <config.h>
@@ -3310,6 +3310,25 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val);
}
void
isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
#if defined(IPV6_V6ONLY)
int onoff = yes ? 1 : 0;
#else
UNUSED(yes);
UNUSED(sock);
#endif
REQUIRE(VALID_SOCKET(sock));
#ifdef IPV6_V6ONLY
if (sock->pf == AF_INET6) {
(void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&onoff, sizeof(onoff));
}
#endif
}
#ifndef ISC_PLATFORM_USETHREADS
void
isc__socketmgr_getfdsets(fd_set *readset, fd_set *writeset, int *maxfd) {

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.11 2001/11/27 01:56:22 gson Exp $ */
/* $Id: socket.c,v 1.12 2001/11/29 07:31:23 marka Exp $ */
#define MAKE_EXTERNAL 1
@@ -3401,3 +3401,11 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val);
}
void
isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
UNUSED(yes);
UNUSED(sock);
REQUIRE(VALID_SOCKET(sock));
}