#endif /* HAVE_SYSCTLBYNAME */
-static isc_once_t once_ipv6only = ISC_ONCE_INIT;
#ifdef __notyet__
static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT;
#endif /* ifdef __notyet__ */
static isc_result_t ipv4_result = ISC_R_NOTFOUND;
static isc_result_t ipv6_result = ISC_R_NOTFOUND;
-static isc_result_t ipv6only_result = ISC_R_NOTFOUND;
static isc_result_t ipv6pktinfo_result = ISC_R_NOTFOUND;
static isc_result_t
return ipv6_result;
}
-static void
-try_ipv6only(void) {
-#ifdef IPV6_V6ONLY
- int s, on;
-#endif /* ifdef IPV6_V6ONLY */
- isc_result_t result;
-
- result = isc_net_probeipv6();
- if (result != ISC_R_SUCCESS) {
- ipv6only_result = result;
- return;
- }
-
-#ifndef IPV6_V6ONLY
- ipv6only_result = ISC_R_NOTFOUND;
- return;
-#else /* ifndef IPV6_V6ONLY */
- /* check for TCP sockets */
- s = socket(PF_INET6, SOCK_STREAM, 0);
- if (s == -1) {
- UNEXPECTED_SYSERROR(errno, "socket()");
- ipv6only_result = ISC_R_UNEXPECTED;
- return;
- }
-
- on = 1;
- if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
- ipv6only_result = ISC_R_NOTFOUND;
- goto close;
- }
-
- close(s);
-
- /* check for UDP sockets */
- s = socket(PF_INET6, SOCK_DGRAM, 0);
- if (s == -1) {
- UNEXPECTED_SYSERROR(errno, "socket()");
- ipv6only_result = ISC_R_UNEXPECTED;
- return;
- }
-
- on = 1;
- if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
- ipv6only_result = ISC_R_NOTFOUND;
- goto close;
- }
-
- ipv6only_result = ISC_R_SUCCESS;
-
-close:
- close(s);
- return;
-#endif /* IPV6_V6ONLY */
-}
-
-static void
-initialize_ipv6only(void) {
- isc_once_do(&once_ipv6only, try_ipv6only);
-}
-
#ifdef __notyet__
static void
try_ipv6pktinfo(void) {
}
#endif /* ifdef __notyet__ */
-isc_result_t
-isc_net_probe_ipv6only(void) {
- initialize_ipv6only();
- return ipv6only_result;
-}
-
isc_result_t
isc_net_probe_ipv6pktinfo(void) {
/*
isc_interfaceiter_t *iter = NULL;
bool scan_ipv4 = false;
bool scan_ipv6 = false;
- bool ipv6only = true;
bool ipv6pktinfo = true;
isc_result_t result;
isc_netaddr_t zero_address, zero_address6;
* packets as the form of mapped addresses unintentionally
* unless explicitly allowed.
*/
- if (scan_ipv6 && isc_net_probe_ipv6only() != ISC_R_SUCCESS) {
- ipv6only = false;
- log_explicit = true;
- }
if (scan_ipv6 && isc_net_probe_ipv6pktinfo() != ISC_R_SUCCESS) {
ipv6pktinfo = false;
log_explicit = true;
}
- if (scan_ipv6 && ipv6only && ipv6pktinfo) {
+ if (scan_ipv6 && ipv6pktinfo) {
for (le = ISC_LIST_HEAD(mgr->listenon6->elts); le != NULL;
le = ISC_LIST_NEXT(le, link))
{
* The case of "any" IPv6 address will require
* special considerations later, so remember it.
*/
- if (family == AF_INET6 && ipv6only && ipv6pktinfo &&
+ if (family == AF_INET6 && ipv6pktinfo &&
listenon_is_ip6_any(le))
{
ipv6_wildcard = true;