getnameinfo problems in glibc 2.4
Robert Wuest
rwuest@wuest.org
Wed Jan 31 15:30:00 GMT 2007
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
More information about the Libc-alpha
mailing list