net.c revision cc32d38366fa680fc29f9fb17bd3ebe515835445
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * Copyright (C) 1999-2003 Internet Software Consortium.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * Permission to use, copy, modify, and distribute this software for any
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * purpose with or without fee is hereby granted, provided that the above
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * copyright notice and this permission notice appear in all copies.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * PERFORMANCE OF THIS SOFTWARE.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley/* $Id: net.c,v 1.30 2004/04/29 01:37:13 marka Exp $ */
44aae046c38e796e581110b7ecdf4478167d684dBob Halley#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY)
44aae046c38e796e581110b7ecdf4478167d684dBob Halleyconst struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT;
44aae046c38e796e581110b7ecdf4478167d684dBob Halley#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
44aae046c38e796e581110b7ecdf4478167d684dBob Halleyconst struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT;
44aae046c38e796e581110b7ecdf4478167d684dBob Halleystatic isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT;
44aae046c38e796e581110b7ecdf4478167d684dBob Halleystatic isc_result_t ipv6only_result = ISC_R_NOTFOUND;
static isc_result_t
switch (errno) {
#ifdef EAFNOSUPPORT
case EAFNOSUPPORT:
#ifdef EPROTONOSUPPORT
case EPROTONOSUPPORT:
#ifdef EINVAL
case EINVAL:
return (ISC_R_NOTFOUND);
strbuf);
return (ISC_R_UNEXPECTED);
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
unsigned int len;
(void)close(s);
return (result);
initialize_action(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
initialize(void) {
isc_net_probeipv4(void) {
initialize();
return (ipv4_result);
isc_net_probeipv6(void) {
initialize();
return (ipv6_result);
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
try_ipv6only(void) {
#ifdef IPV6_V6ONLY
int s, on;
#ifndef IPV6_V6ONLY
strbuf);
goto close;
close(s);
strbuf);
goto close;
close(s);
close(s);
initialize_ipv6only(void) {
try_ipv6pktinfo(void) {
int s, on;
int optname;
strbuf);
#ifdef IPV6_RECVPKTINFO
goto close;
close(s);
close(s);
initialize_ipv6pktinfo(void) {
isc_net_probe_ipv6only(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
return (ipv6only_result);
isc_net_probe_ipv6pktinfo(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
return (ipv6pktinfo_result);
isc_net_disableipv4(void) {
initialize();
isc_net_disableipv6(void) {
initialize();
isc_net_enableipv4(void) {
initialize();
isc_net_enableipv6(void) {
initialize();