Bug 155626 - getaddrinfo does extraneous IPv6 lookups in spite of IPv4 address in /etc/hosts
getaddrinfo does extraneous IPv6 lookups in spite of IPv4 address in /etc/hosts
Status: CLOSED NEXTRELEASE
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: glibc (Show other bugs)
2.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-21 19:08 EDT by David Lehman
Modified: 2016-11-24 09:54 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-09 15:37:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Lehman 2005-04-21 19:08:53 EDT
Description of problem:
getaddrinfo does an IPv6 "dns" lookup implicitly when doing IPv6 "file" lookup.
 For example, if nsswitch.conf contains the line "hosts: files dns" and host foo
is in /etc/hosts as an IPv4 address, getaddrinfo does ipv6 file, then ipv6 dns,
then ipv4 file lookups. This was changed at some point in 2.3.2 to behave as
advertised.

When DNS is down this takes a long time to timeout before checking /etc/hosts.
It takes 20 seconds for me on RHEL2.1-U6 with a bogus nameserver entry in
resolv.conf.

Version-Release number of selected component (if applicable):
glibc-2.2.4-32.18

How reproducible:
Always

Steps to Reproduce:
1. set resolv.conf to point at an unresolveable address
2. set hosts line in nsswitch to "files dns"
3. place a valid IPv4 entry in /etc/hosts for some host
4. call getaddrinfo (eg: telnet to it the host you added to /etc/hosts)
  
Actual results:
A 20 second delay (2 poll calls with 5 second timeout per "attempt")

Expected results:
no delay

Additional info:
This is pretty much the same as bug 84105 except this is against RHEL2.1 and is
being opened on behalf of a customer who opened an IssueTracker ticket. They are
requesting a backport or, possibly, a workaround (I've already told them they
can add the line "options: timeout:1 attempts:1" in resolv.conf)


This is my understanding of the situation:
Suppose nsswitch.conf has the following hosts line:

hosts:         files dns

Currently getaddrinfo does the following:
 1. check for IPv6 address in files
 2. check for IPv6 address in DNS
 3. check for IPv4 address in files
 4. check for IPv4 address in DNS

The glibc-2.3.2 getaddrinfo does the following:
 1. check for IPv6 address in files
 2. check for IPv4 address in files
 3. check for IPv6 address in DNS
 4. check for IPv4 address in DNS
Comment 1 Elena Zannoni 2005-05-09 15:37:43 EDT
Fixed in RHEL3 and RHEL4, not slated for fixing in AS2.1

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