This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug network/15726] getaddrinfo() returns incorrect status
- From: "kurt at roeckx dot be" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 11 Jul 2013 16:54:33 +0000
- Subject: [Bug network/15726] getaddrinfo() returns incorrect status
- Auto-submitted: auto-generated
- References: <bug-15726-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=15726
--- Comment #8 from Kurt Roeckx <kurt at roeckx dot be> ---
So I've been looking into the case of a negative response. It's clear to me
that it's not documented properly in the standard(s), and I can see how you can
interprete either EAI_FAIL or EAI_NONAME as the proper answer. And I have no
problem with either as reply.
Looking at the history of it, rfc 2133 and 2553 had:
EAI_FAIL non-recoverable failure in name resolution
EAI_NODATA no address associated with nodename
EAI_NONAME nodename nor servname provided, or not known
Looking at old wrappers around gethostbyname, I find code like this:
hptr = gethostbyname(host);
if (hptr == NULL) {
switch (h_errno) {
case HOST_NOT_FOUND: return(EAI_NONAME);
case TRY_AGAIN: return(EAI_AGAIN);
case NO_RECOVERY: return(EAI_FAIL);
case NO_DATA: return(EAI_NODATA);
default: return(EAI_NONAME);
}
}
Tht is code written by W. Richard Stevens, among other things co-author of the
rfc.
Those error codes are defined as:
HOST_NOT_FOUND
No such host is known.
NO_DATA
The server recognized the request and the name, but no address
is available. Another type of request to the name server for the
domain might return an answer.
NO_RECOVERY
An unexpected server failure occurred which cannot be recovered.
TRY_AGAIN
A temporary and possibly transient error occurred, such as a
failure of a server to respond.
Kurt
--
You are receiving this mail because:
You are on the CC list for the bug.