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

update copyright notice

This commit is contained in:
Automatic Updater
2009-08-15 23:48:06 +00:00
parent bde521789e
commit 800fb35bf0

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium. * Copyright (C) 1999-2003 Internet Software Consortium.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: getipnode.c,v 1.44 2009/08/15 05:03:14 each Exp $ */ /* $Id: getipnode.c,v 1.45 2009/08/15 23:48:06 tbox Exp $ */
/*! \file */ /*! \file */
@@ -23,7 +23,7 @@
* These functions perform thread safe, protocol independent * These functions perform thread safe, protocol independent
* nodename-to-address and address-to-nodename translation as defined in * nodename-to-address and address-to-nodename translation as defined in
* RFC2553. This use a struct hostent which is defined in namedb.h: * RFC2553. This use a struct hostent which is defined in namedb.h:
* *
* \code * \code
* struct hostent { * struct hostent {
* char *h_name; // official name of host * char *h_name; // official name of host
@@ -34,90 +34,90 @@
* }; * };
* #define h_addr h_addr_list[0] // address, for backward compatibility * #define h_addr h_addr_list[0] // address, for backward compatibility
* \endcode * \endcode
* *
* The members of this structure are: * The members of this structure are:
* *
* \li h_name: * \li h_name:
* The official (canonical) name of the host. * The official (canonical) name of the host.
* *
* \li h_aliases: * \li h_aliases:
* A NULL-terminated array of alternate names (nicknames) for the * A NULL-terminated array of alternate names (nicknames) for the
* host. * host.
* *
* \li h_addrtype: * \li h_addrtype:
* The type of address being returned - usually PF_INET or * The type of address being returned - usually PF_INET or
* PF_INET6. * PF_INET6.
* *
* \li h_length: * \li h_length:
* The length of the address in bytes. * The length of the address in bytes.
* *
* \li h_addr_list: * \li h_addr_list:
* A NULL terminated array of network addresses for the host. Host * A NULL terminated array of network addresses for the host. Host
* addresses are returned in network byte order. * addresses are returned in network byte order.
* *
* lwres_getipnodebyname() looks up addresses of protocol family af for * lwres_getipnodebyname() looks up addresses of protocol family af for
* the hostname name. The flags parameter contains ORed flag bits to * the hostname name. The flags parameter contains ORed flag bits to
* specify the types of addresses that are searched for, and the types of * specify the types of addresses that are searched for, and the types of
* addresses that are returned. The flag bits are: * addresses that are returned. The flag bits are:
* *
* \li #AI_V4MAPPED: * \li #AI_V4MAPPED:
* This is used with an af of #AF_INET6, and causes IPv4 addresses * This is used with an af of #AF_INET6, and causes IPv4 addresses
* to be returned as IPv4-mapped IPv6 addresses. * to be returned as IPv4-mapped IPv6 addresses.
* *
* \li #AI_ALL: * \li #AI_ALL:
* This is used with an af of #AF_INET6, and causes all known * This is used with an af of #AF_INET6, and causes all known
* addresses (IPv6 and IPv4) to be returned. If #AI_V4MAPPED is * addresses (IPv6 and IPv4) to be returned. If #AI_V4MAPPED is
* also set, the IPv4 addresses are return as mapped IPv6 * also set, the IPv4 addresses are return as mapped IPv6
* addresses. * addresses.
* *
* \li #AI_ADDRCONFIG: * \li #AI_ADDRCONFIG:
* Only return an IPv6 or IPv4 address if here is an active * Only return an IPv6 or IPv4 address if here is an active
* network interface of that type. This is not currently * network interface of that type. This is not currently
* implemented in the BIND 9 lightweight resolver, and the flag is * implemented in the BIND 9 lightweight resolver, and the flag is
* ignored. * ignored.
* *
* \li #AI_DEFAULT: * \li #AI_DEFAULT:
* This default sets the #AI_V4MAPPED and #AI_ADDRCONFIG flag bits. * This default sets the #AI_V4MAPPED and #AI_ADDRCONFIG flag bits.
* *
* lwres_getipnodebyaddr() performs a reverse lookup of address src which * lwres_getipnodebyaddr() performs a reverse lookup of address src which
* is len bytes long. af denotes the protocol family, typically PF_INET * is len bytes long. af denotes the protocol family, typically PF_INET
* or PF_INET6. * or PF_INET6.
* *
* lwres_freehostent() releases all the memory associated with the struct * lwres_freehostent() releases all the memory associated with the struct
* hostent pointer. Any memory allocated for the h_name, h_addr_list * hostent pointer. Any memory allocated for the h_name, h_addr_list
* and h_aliases is freed, as is the memory for the hostent structure * and h_aliases is freed, as is the memory for the hostent structure
* itself. * itself.
* *
* \section getipnode_return Return Values * \section getipnode_return Return Values
* *
* If an error occurs, lwres_getipnodebyname() and * If an error occurs, lwres_getipnodebyname() and
* lwres_getipnodebyaddr() set *error_num to an appropriate error code * lwres_getipnodebyaddr() set *error_num to an appropriate error code
* and the function returns a NULL pointer. The error codes and their * and the function returns a NULL pointer. The error codes and their
* meanings are defined in \link netdb.h <lwres/netdb.h>\endlink: * meanings are defined in \link netdb.h <lwres/netdb.h>\endlink:
* *
* \li #HOST_NOT_FOUND: * \li #HOST_NOT_FOUND:
* No such host is known. * No such host is known.
* *
* \li #NO_ADDRESS: * \li #NO_ADDRESS:
* The server recognised the request and the name but no address * The server recognised the request and the name but no address
* is available. Another type of request to the name server for * is available. Another type of request to the name server for
* the domain might return an answer. * the domain might return an answer.
* *
* \li #TRY_AGAIN: * \li #TRY_AGAIN:
* A temporary and possibly transient error occurred, such as a * A temporary and possibly transient error occurred, such as a
* failure of a server to respond. The request may succeed if * failure of a server to respond. The request may succeed if
* retried. * retried.
* *
* \li #NO_RECOVERY: * \li #NO_RECOVERY:
* An unexpected failure occurred, and retrying the request is * An unexpected failure occurred, and retrying the request is
* pointless. * pointless.
* *
* lwres_hstrerror() translates these error codes to suitable error * lwres_hstrerror() translates these error codes to suitable error
* messages. * messages.
* *
* \section getipnode_see See Also * \section getipnode_see See Also
* *
* getaddrinfo.c, gethost.c, getnameinfo.c, herror.c, RFC2553 * getaddrinfo.c, gethost.c, getnameinfo.c, herror.c, RFC2553
*/ */
#include <config.h> #include <config.h>
@@ -146,21 +146,21 @@ LIBLWRES_EXTERNAL_DATA const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
#ifndef IN6_IS_ADDR_V4COMPAT #ifndef IN6_IS_ADDR_V4COMPAT
static const unsigned char in6addr_compat[12] = { static const unsigned char in6addr_compat[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
#define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \ #define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \
((x)->s6_addr[12] != 0 || \ ((x)->s6_addr[12] != 0 || \
(x)->s6_addr[13] != 0 || \ (x)->s6_addr[13] != 0 || \
(x)->s6_addr[14] != 0 || \ (x)->s6_addr[14] != 0 || \
((x)->s6_addr[15] != 0 && \ ((x)->s6_addr[15] != 0 && \
(x)->s6_addr[15] != 1))) (x)->s6_addr[15] != 1)))
#endif #endif
#ifndef IN6_IS_ADDR_V4MAPPED #ifndef IN6_IS_ADDR_V4MAPPED
#define IN6_IS_ADDR_V4MAPPED(x) (!memcmp((x)->s6_addr, in6addr_mapped, 12)) #define IN6_IS_ADDR_V4MAPPED(x) (!memcmp((x)->s6_addr, in6addr_mapped, 12))
#endif #endif
static const unsigned char in6addr_mapped[12] = { static const unsigned char in6addr_mapped[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff
}; };
/*** /***
@@ -492,7 +492,7 @@ lwres_freehostent(struct hostent *he) {
*/ */
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \ #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
!defined(IRIX_EMUL_IOCTL_SIOCGIFCONF) !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
#ifdef __hpux #ifdef __hpux
#define lifc_len iflc_len #define lifc_len iflc_len
@@ -504,7 +504,7 @@ lwres_freehostent(struct hostent *he) {
#define ISC_HAVE_LIFC_FLAGS 1 #define ISC_HAVE_LIFC_FLAGS 1
#define LIFCONF lifconf #define LIFCONF lifconf
#endif #endif
#ifdef __hpux #ifdef __hpux
#define lifr_addr iflr_addr #define lifr_addr iflr_addr
#define lifr_name iflr_name #define lifr_name iflr_name
@@ -557,7 +557,7 @@ scan_interfaces6(int *have_v4, int *have_v6) {
/* /*
* Some OS's just return what will fit rather * Some OS's just return what will fit rather
* than set EINVAL if the buffer is too small * than set EINVAL if the buffer is too small
* to fit all the interfaces in. If * to fit all the interfaces in. If
* lifc.lifc_len is too near to the end of the * lifc.lifc_len is too near to the end of the
* buffer we will grow it just in case and * buffer we will grow it just in case and
* retry. * retry.
@@ -619,13 +619,13 @@ scan_interfaces6(int *have_v4, int *have_v6) {
if ((lifreq.lifr_flags & IFF_UP) == 0) if ((lifreq.lifr_flags & IFF_UP) == 0)
break; break;
*have_v4 = 1; *have_v4 = 1;
} }
break; break;
case AF_INET6: case AF_INET6:
if (*have_v6 == 0) { if (*have_v6 == 0) {
memcpy(&in6, memcpy(&in6,
&((struct sockaddr_in6 *) &((struct sockaddr_in6 *)
&lifreq.lifr_addr)->sin6_addr, &lifreq.lifr_addr)->sin6_addr,
sizeof(in6)); sizeof(in6));
if (memcmp(&in6, &in6addr_any, if (memcmp(&in6, &in6addr_any,
sizeof(in6)) == 0) sizeof(in6)) == 0)
@@ -675,7 +675,7 @@ scan_interfaces(int *have_v4, int *have_v6) {
InitSockets(); InitSockets();
#endif #endif
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \ #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
!defined(IRIX_EMUL_IOCTL_SIOCGIFCONF) !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
/* /*
* Try to scan the interfaces using IPv6 ioctls(). * Try to scan the interfaces using IPv6 ioctls().
*/ */
@@ -721,7 +721,7 @@ scan_interfaces(int *have_v4, int *have_v6) {
/* /*
* Some OS's just return what will fit rather * Some OS's just return what will fit rather
* than set EINVAL if the buffer is too small * than set EINVAL if the buffer is too small
* to fit all the interfaces in. If * to fit all the interfaces in. If
* ifc.ifc_len is too near to the end of the * ifc.ifc_len is too near to the end of the
* buffer we will grow it just in case and * buffer we will grow it just in case and
* retry. * retry.
@@ -786,7 +786,7 @@ scan_interfaces(int *have_v4, int *have_v6) {
if ((u.ifreq.ifr_flags & IFF_UP) == 0) if ((u.ifreq.ifr_flags & IFF_UP) == 0)
break; break;
*have_v4 = 1; *have_v4 = 1;
} }
break; break;
case AF_INET6: case AF_INET6:
if (*have_v6 == 0) { if (*have_v6 == 0) {