summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/bind/irs/getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind9/lib/bind/irs/getaddrinfo.c')
-rw-r--r--contrib/bind9/lib/bind/irs/getaddrinfo.c95
1 files changed, 49 insertions, 46 deletions
diff --git a/contrib/bind9/lib/bind/irs/getaddrinfo.c b/contrib/bind9/lib/bind/irs/getaddrinfo.c
index c8d1ab3..1839ba4 100644
--- a/contrib/bind9/lib/bind/irs/getaddrinfo.c
+++ b/contrib/bind9/lib/bind/irs/getaddrinfo.c
@@ -29,48 +29,52 @@
* SUCH DAMAGE.
*/
-/*
+/*! \file
* Issues to be discussed:
- * - Thread safe-ness must be checked.
- * - Return values. There are nonstandard return values defined and used
+ *\li Thread safe-ness must be checked.
+ *\li Return values. There are nonstandard return values defined and used
* in the source code. This is because RFC2553 is silent about which error
* code must be returned for which situation.
- * - IPv4 classful (shortened) form. RFC2553 is silent about it. XNET 5.2
+ *\li IPv4 classful (shortened) form. RFC2553 is silent about it. XNET 5.2
* says to use inet_aton() to convert IPv4 numeric to binary (allows
* classful form as a result).
* current code - disallow classful form for IPv4 (due to use of inet_pton).
- * - freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is
+ *\li freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is
* invalid.
* current code - SEGV on freeaddrinfo(NULL)
* Note:
- * - We use getipnodebyname() just for thread-safeness. There's no intent
+ *\li We use getipnodebyname() just for thread-safeness. There's no intent
* to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to
* getipnodebyname().
- * - The code filters out AFs that are not supported by the kernel,
+ *\li The code filters out AFs that are not supported by the kernel,
* when globbing NULL hostname (to loopback, or wildcard). Is it the right
* thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG
* in ai_flags?
- * - (post-2553) semantics of AI_ADDRCONFIG itself is too vague.
+ *\li (post-2553) semantics of AI_ADDRCONFIG itself is too vague.
* (1) what should we do against numeric hostname (2) what should we do
* against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready?
* non-loopback address configured? global address configured?
- * - To avoid search order issue, we have a big amount of code duplicate
+ * \par Additional Issue:
+ * To avoid search order issue, we have a big amount of code duplicate
* from gethnamaddr.c and some other places. The issues that there's no
* lower layer function to lookup "IPv4 or IPv6" record. Calling
* gethostbyname2 from getaddrinfo will end up in wrong search order, as
* follows:
- * - The code makes use of following calls when asked to resolver with
+ * \li The code makes use of following calls when asked to resolver with
* ai_family = PF_UNSPEC:
- * getipnodebyname(host, AF_INET6);
+ *\code getipnodebyname(host, AF_INET6);
* getipnodebyname(host, AF_INET);
- * This will result in the following queries if the node is configure to
+ *\endcode
+ * \li This will result in the following queries if the node is configure to
* prefer /etc/hosts than DNS:
+ *\code
* lookup /etc/hosts for IPv6 address
* lookup DNS for IPv6 address
* lookup /etc/hosts for IPv4 address
* lookup DNS for IPv4 address
+ *\endcode
* which may not meet people's requirement.
- * The right thing to happen is to have underlying layer which does
+ * \li The right thing to happen is to have underlying layer which does
* PF_UNSPEC lookup (lookup both) and return chain of addrinfos.
* This would result in a bit of code duplicate with _dns_ghbyname() and
* friends.
@@ -199,20 +203,20 @@ struct addrinfo *addr2addrinfo __P((const struct addrinfo *,
#if 0
static const char *ai_errlist[] = {
"Success",
- "Address family for hostname not supported", /* EAI_ADDRFAMILY */
- "Temporary failure in name resolution", /* EAI_AGAIN */
- "Invalid value for ai_flags", /* EAI_BADFLAGS */
- "Non-recoverable failure in name resolution", /* EAI_FAIL */
- "ai_family not supported", /* EAI_FAMILY */
- "Memory allocation failure", /* EAI_MEMORY */
- "No address associated with hostname", /* EAI_NODATA */
- "hostname nor servname provided, or not known", /* EAI_NONAME */
- "servname not supported for ai_socktype", /* EAI_SERVICE */
- "ai_socktype not supported", /* EAI_SOCKTYPE */
- "System error returned in errno", /* EAI_SYSTEM */
- "Invalid value for hints", /* EAI_BADHINTS */
- "Resolved protocol is unknown", /* EAI_PROTOCOL */
- "Unknown error", /* EAI_MAX */
+ "Address family for hostname not supported", /*%< EAI_ADDRFAMILY */
+ "Temporary failure in name resolution", /*%< EAI_AGAIN */
+ "Invalid value for ai_flags", /*%< EAI_BADFLAGS */
+ "Non-recoverable failure in name resolution", /*%< EAI_FAIL */
+ "ai_family not supported", /*%< EAI_FAMILY */
+ "Memory allocation failure", /*%< EAI_MEMORY */
+ "No address associated with hostname", /*%< EAI_NODATA */
+ "hostname nor servname provided, or not known", /*%< EAI_NONAME */
+ "servname not supported for ai_socktype", /*%< EAI_SERVICE */
+ "ai_socktype not supported", /*%< EAI_SOCKTYPE */
+ "System error returned in errno", /*%< EAI_SYSTEM */
+ "Invalid value for hints", /*%< EAI_BADHINTS */
+ "Resolved protocol is unknown", /*%< EAI_PROTOCOL */
+ "Unknown error", /*%< EAI_MAX */
};
#endif
@@ -268,7 +272,7 @@ do { \
#define MATCH(x, y, w) \
((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
-#if 0 /* bind8 has its own version */
+#if 0 /*%< bind8 has its own version */
char *
gai_strerror(ecode)
int ecode;
@@ -352,7 +356,7 @@ getaddrinfo(hostname, servname, hints, res)
/* error check for hints */
if (hints->ai_addrlen || hints->ai_canonname ||
hints->ai_addr || hints->ai_next)
- SETERROR(EAI_BADHINTS); /* xxx */
+ SETERROR(EAI_BADHINTS); /*%< xxx */
if (hints->ai_flags & ~AI_MASK)
SETERROR(EAI_BADFLAGS);
switch (hints->ai_family) {
@@ -517,7 +521,7 @@ getaddrinfo(hostname, servname, hints, res)
goto free;
}
if (afai == NULL) {
- error = EAI_NONAME; /* we've had no errors. */
+ error = EAI_NONAME; /*%< we've had no errors. */
goto free;
}
@@ -574,7 +578,7 @@ getaddrinfo(hostname, servname, hints, res)
cur = cur->ai_next;
}
- freeaddrinfo(afai); /* afai must not be NULL at this point. */
+ freeaddrinfo(afai); /*%< afai must not be NULL at this point. */
if (sentinel.ai_next) {
good:
@@ -597,7 +601,7 @@ bad:
return(error);
}
-/*
+/*%
* FQDN hostname, DNS lookup
*/
static int
@@ -625,7 +629,7 @@ explore_fqdn(pai, hostname, servname, res)
if (!net_data || !(ho = net_data->ho))
return(0);
-#if 0 /* XXX (notyet) */
+#if 0 /*%< XXX (notyet) */
if (net_data->ho_stayopen && net_data->ho_last &&
net_data->ho_last->h_addrtype == af) {
if (ns_samename(name, net_data->ho_last->h_name) == 1)
@@ -661,7 +665,7 @@ explore_fqdn(pai, hostname, servname, res)
error = EAI_NONAME;
break;
default:
- case NETDB_SUCCESS: /* should be impossible... */
+ case NETDB_SUCCESS: /*%< should be impossible... */
error = EAI_NONAME;
break;
}
@@ -669,7 +673,7 @@ explore_fqdn(pai, hostname, servname, res)
}
for (cur = result; cur; cur = cur->ai_next) {
- GET_PORT(cur, servname); /* XXX: redundant lookups... */
+ GET_PORT(cur, servname); /*%< XXX: redundant lookups... */
/* canonname should already be filled. */
}
@@ -685,8 +689,8 @@ free:
static int
explore_copy(pai, src0, res)
- const struct addrinfo *pai; /* seed */
- const struct addrinfo *src0; /* source */
+ const struct addrinfo *pai; /*%< seed */
+ const struct addrinfo *src0; /*%< source */
struct addrinfo **res;
{
int error;
@@ -720,7 +724,7 @@ fail:
return error;
}
-/*
+/*%
* hostname == NULL.
* passive socket -> anyaddr (0.0.0.0 or ::)
* non-passive socket -> localhost (127.0.0.1 or ::1)
@@ -768,7 +772,7 @@ free:
return error;
}
-/*
+/*%
* numeric hostname
*/
static int
@@ -831,7 +835,7 @@ bad:
return error;
}
-/*
+/*%
* numeric hostname with scope
*/
static int
@@ -882,7 +886,7 @@ explore_numeric_scope(pai, hostname, servname, res)
sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
if (!ip6_str2scopeid(scope, sin6, &scopeid)) {
free(hostname2);
- return(EAI_NONAME); /* XXX: is return OK? */
+ return(EAI_NONAME); /*%< XXX: is return OK? */
}
#ifdef HAVE_SIN6_SCOPE_ID
sin6->sin6_scope_id = scopeid;
@@ -1078,7 +1082,7 @@ find_afd(af)
return NULL;
}
-/*
+/*%
* post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend
* will take care of it.
* the semantics of AI_ADDRCONFIG is not defined well. we are not sure
@@ -1136,8 +1140,7 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6,
if (IN6_IS_ADDR_MC_ORGLOCAL(a6))
goto trynumeric;
else
- goto trynumeric; /* global */
-
+ goto trynumeric; /*%< global */
/* try to convert to a numeric id as a last resort */
trynumeric:
errno = 0;
@@ -1174,7 +1177,7 @@ hostent2addrinfo(hp, pai)
cur = &sentinel;
for (i = 0; (ap = aplist[i]) != NULL; i++) {
-#if 0 /* the trick seems too much */
+#if 0 /*%< the trick seems too much */
af = hp->h_addr_list;
if (af == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
@@ -1198,7 +1201,7 @@ hostent2addrinfo(hp, pai)
*/
GET_CANONNAME(cur->ai_next, hp->h_name);
}
- while (cur->ai_next) /* no need to loop, actually. */
+ while (cur->ai_next) /*%< no need to loop, actually. */
cur = cur->ai_next;
continue;
OpenPOWER on IntegriCloud