Bug 11777

Summary: gethostbyaddr doesn't cache at all.
Product: [Retired] Red Hat Linux Reporter: michael
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 6.2CC: drepper, fweimer, michael
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-04 06:55:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description michael 2000-05-31 10:38:35 UTC
glibc will never use the value returned from nscd for a
gethostbyaddr because it's always too short.

There's a fragment in glibc that does...
	
	if (__readv( ... ) != total_len ) {
		__close(socket);	
		return -1;
	}

The problem is that glibc is expecting to get the name, followed
by the IPv4 addresses, FOLLOWED BY THE IPv6 addresses!!

So glibc is expecting to see 40 bytes typically, but nscd
is only every writting the IPv4 address (i.e a total of 24 bytes).

glibc is confused, to returns a failure. nscd thus doesn't cache. 
fun. :(

My hack was to have nscd write an extra 60 bytes on each
request. (yuck). because glibc is reading the right len, it'll
just junk the remainder when it does the close. So it'll use
the value.

The real fix is either change glibc to not expect the IPv6
addresses if it didn't ask for them, or change nscd to always
return a NULL IPv6 address.

Comment 1 Cristian Gafton 2000-08-09 02:42:14 UTC
assigned to jakub

Comment 2 Ulrich Drepper 2004-10-04 06:55:57 UTC
This has long since been fixed.