Bug 155626 - getaddrinfo does extraneous IPv6 lookups in spite of IPv4 address in /etc/hosts
Summary: getaddrinfo does extraneous IPv6 lookups in spite of IPv4 address in /etc/hosts
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: glibc
Version: 2.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-21 23:08 UTC by David Lehman
Modified: 2016-11-24 14:54 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-09 19:37:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description David Lehman 2005-04-21 23:08:53 UTC
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 19:37:43 UTC
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.