Bug 11777 - gethostbyaddr doesn't cache at all.
Summary: gethostbyaddr doesn't cache at all.
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-05-31 10:38 UTC by michael
Modified: 2016-11-24 15:04 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-04 06:55:57 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

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 ) {
		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.

Note You need to log in before you can comment on or make changes to this bug.