This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
getnameinfo problems in glibc 2.4
- From: Robert Wuest <rwuest at wuest dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 31 Jan 2007 08:27:00 -0700
- Subject: getnameinfo problems in glibc 2.4
I am a maintainer of a custom Linux distro for my companies products
(MIPS based HPC platform). I am upgrading the entire system from
gcc-3.4.3/glibc-2.3.3 to gcc-4.2/glibc-2.4 and I have run into a quirk
with telnet. I'm not sure if this is a bug or a new feature I don't
understand. It works as expected in glibc-2.3.3.
Telnet calls getnaminfo with the following line of code:
error = getnameinfo (who, who_len,
remote_host_name,
sizeof(remote_host_name),
NULL, 0,
registerd_host_only ? NI_NAMEREQD : 0);
I seems to not matter what registerd_host_only is set to (it is normally
0), if I do not have a name server configured, I get an error return
value (EAI_AGAIN). I can work around it with a hosts line in
nsswitch.conf as:
hosts: files dns [NOTFOUND=success]
Maybe I am misinterpretting the NI_NAMEREQD flag. the man page says:
"NI_NAMEREQD
If set, then a error is returned if the hostname cannot be looked
up."
So what happens if NI_NAMEREQD is not set? My logic inverts this as:
NI_NAMEREQD
If not set, then a error is not returned if the hostname cannot be looked
up.
But that is not what is happening. If a nameserver is not found
(without the [NOTFOUND=success] in nsswitch.conf), getnameinfo returns
EAI_AGAIN. Seems redundant.
Can someone enlighten me on the correct way to handle this?
Robert