This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/15726] getaddrinfo() returns incorrect status


https://sourceware.org/bugzilla/show_bug.cgi?id=15726

--- Comment #26 from Rich Felker <bugdal at aerifal dot cx> ---
I disagree with this:

"In case there was a negative answer it's unclear what should be returned. Some
implementations return EAI_FAIL, others EAI_NONAME."

In the case of a negative answer, EAI_NONAME is the only correct answer. You
have an answer: the name does not resolve. POSIX directly specifies this as:

[EAI_NONAME]
The name does not resolve for the supplied parameters. [or]
Neither nodename nor servname were supplied. At least one of these shall be
supplied.

The only time EAI_FAIL would be appropriate is when you don't have a local
system reason for the failure that would be reportable in errno, but rather an
error reported by the nameserver. For instance (this one actually hit me
recently due to misconfiguration in a resolv.conf file) the nameserver could
give response code 5 (Refused) if it's authoritative-only and you're sending
recursive requests to it, or if it's configured to be accessible only to
certain client IP addresses. This condition should probably be ignored however
if there are other nameservers to fall back to. As for the other response
codes, most of them seem to be things that either should not happen, or that
would warrant EAI_AGAIN rather than EAI_FAIL.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]