This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: return value of getnameinfo() + NI_NAMEREQD
- From: Bernhard Schmidt <berni at birkenwald dot de>
- To: libc-alpha at sourceware dot org
- Date: Sun, 15 Jun 2008 00:27:32 +0200
- Subject: Re: return value of getnameinfo() + NI_NAMEREQD
- References: <48442722.8080407@birkenwald.de>
On Mon, Jun 02, 2008 at 07:00:18PM +0200, Bernhard Schmidt wrote:
Hello again,
> Now, apparently Postfix does getnameinfo() with NI_NAMEREQD for a) and
> expects EAI_AGAIN, EAI_MEMORY or EAI_SYSTEM as marker for a temporary
> error, while glibc appears to be returning EAI_NODATA if NI_NAMEREQD is
> set. I think (I'm nowhere near to understanding C) the responsible code
> is in lines 294-300 in inet/getnameinfo.c:
>
> 1.16 drepper 294: if (!ok)
> 1.8 drepper 295: {
> 1.16 drepper 296: if (flags & NI_NAMEREQD)
> 1.8 drepper 297: {
> 298: __set_errno (serrno);
> 1.22 drepper 299: return EAI_NONAME;
> 1.8 drepper 300: }
>
> Reading RFC3493 I think both options are valid, although I tend to be on
> the Postfix side.
For the record, this is not an interpretation issue of RFC3493.
The system we originally experienced these issues on was running SLES
10.1 which includes glibc-2.4. I saw the same behaviour on my
workstation running Ubuntu Hardy (glibc-2.7). Since the getnameinfo()
code had not been changed in CVS since that version I assumed that even
the most current version would still be broken. This assumption is
wrong.
The bug in glibc (not returning EAI_AGAIN when getnameinfo() hits
SERVFAIL or a timeout) was fixed for glibc-2.5 with this commit:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/inet/getnameinfo.c.diff?r1=1.34&r2=1.35&cvsroot=glibc
Hardy with glibc-2.7 still experiencing the same symptoms was caused by
an unrelated bug in the avahi mdns library installed in Ubuntu by
default:
bschmidt@lxbsc01:~$ grep ^hosts: /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
bschmidt@lxbsc01:~$ ./getaddrinfo 62.85.116.236
rv:Name or service not known(-2)
bschmidt@lxbsc01:~$ sudo vim /etc/nsswitch.conf
bschmidt@lxbsc01:~$ grep ^hosts: /etc/nsswitch.conf
hosts: files dns
bschmidt@lxbsc01:~$ ./getaddrinfo 62.85.116.236
rv:Temporary failure in name resolution(-3)
Regards,
Bernhard