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


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

--- Comment #15 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Rich Felker from comment #14)
> On Thu, Jul 18, 2013 at 07:03:09AM +0000, carlos at redhat dot com wrote:
> > What about EAI_NODATA which glibc still uses? It would seem that EAI_NODATA is
> > more likely be returned in the current implementation than EAI_NONAME (which is
> > mostly returned for the parameter errors discussed).
> 
> EAI_NODATA is not even in the specification for this function; I don't
> know why it exists at all, as it could badly confuse conforming
> applications which don't expect a positive "successful query with no
> result" return code other than the specified EAI_NONAME.

EAI_NODATA is defined under GNU source and was part of the getaddrinfo
specification at one point and was then removed.

It is not documented anywhere in glibc (classic glibc).

The linux man pages project says:
~~~
EAI_NODATA
           The specified network host exists, but does not have
           any network addresses defined.
~~~

> On the other hand, I see the motivation, at least according to the
> documentation. The Linux man page suggests glibc is using EAI_NONAME
> when there is no such host/domain name, and EAI_NODATA when the
> hostname exists but does not have any A or AAAA records (nor a CNAME
> pointing to one that does).
> 
> Is it behaving differently from how it's documented?

It behaves as documented.

For example the following pseudo code:
  hints.ai_family = AF_INET6;
  print_errorcode (getaddrinfo ("www.redhat.com", NULL, &hints, &result));

Would print:
  EAI_NODATA

Since the host exists but it has no AAAA record.

If you remove /etc/resolv.conf it prints:
  EAI_NONAME

As expected since given your system configuration there is no such host/domain
name.

Does that make sense?

-- 
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]