Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 11777 - gethostbyaddr doesn't cache at all.
gethostbyaddr doesn't cache at all.
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2000-05-31 06:38 EDT by michael
Modified: 2016-11-24 10:04 EST (History)
3 users (show)

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

Attachments (Terms of Use)

  None (edit)
Description michael 2000-05-31 06:38:35 EDT
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-08 22:42:14 EDT
assigned to jakub
Comment 2 Ulrich Drepper 2004-10-04 02:55:57 EDT
This has long since been fixed.

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