Bug 605003
Summary: | glibc/getent performs ipv6 host lookup when host is defined in /etc/hosts, invalidates nscd cache | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Dag Wieers <dag> |
Component: | glibc | Assignee: | Andreas Schwab <schwab> |
Status: | CLOSED NOTABUG | QA Contact: | qe-baseos-tools-bugs |
Severity: | high | Docs Contact: | |
Priority: | low | ||
Version: | 5.5 | CC: | dag, fweimer |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2010-06-17 10:08:07 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
Dag Wieers
2010-06-17 09:26:47 UTC
We also opened a support service request with number #2032072. If you look at the following output you can see the inconsistency, only when doing a hosts database lookup you see the ipv6 DNS request being made. Even when specifying ahostsv4 it doesn't do it because it is resolved by /etc/hosts, and I assume ahostsv6 fails because ipv6 is disabled. [dag@moria ~]$ strace -e connect getent hosts localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("212.224.255.252")}, 28) = 0 127.0.0.1 localhost.localdomain localhost [dag@moria ~]$ strace -e connect getent ahostsv4 localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) 127.0.0.1 STREAM localhost.localdomain 127.0.0.1 DGRAM 127.0.0.1 RAW [dag@moria ~]$ strace -e connect getent ahostsv6 localhost6 [dag@moria ~]$ strace -e connect getent -s files hosts localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) 127.0.0.1 moria localhost.localdomain localhost [dag@moria ~]$ strace -e connect getent -s dns ahostsv4 localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("212.224.255.252")}, 28) = 0 [dag@moria ~]$ strace -e connect getent -s dns ahostsv6 localhost6 "getent hosts" knows nothing about NSS, it exclusively looks in /etc/hosts and DNS, explicitly asking for IPv6 first. If you want to test the glibc resolver (getaddrinfo) use the ahosts{,v[46]} databases. Well, we are reporting this behavior because it is the same behavior nscd shows. Do you want me to open a new bug-report for nscd ? Can you also confirm that if DNS is unavailable and a hostname/IP is in /etc/hosts, that nscd should not timeout on a DNS issue and refuse to cache when it finally times out and returns the /etc/hosts entry ? "getent hosts" does not go through nscd at all. Thanks for your prompt replies. We thought it did based on this: [dag@moria ~]$ strace -e connect getent hosts localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("212.224.255.252")}, 28) = 0 127.0.0.1 localhost.localdomain localhost [root@moria dstat]# /etc/init.d/nscd restart Stopping nscd: [FAILED] Starting nscd: [ OK ] [root@moria dstat]# nscd -i hosts [dag@moria ~]$ strace -e connect getent hosts localhost connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = 0 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = 0 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = 0 127.0.0.1 localhost.localdomain localhost Yo are right, I misread the code. But this is still not a bug since getent hosts explicitly asks for the IPv6 address. You are right, I misread the code. But this is still not a bug since getent hosts explicitly asks for the IPv6 address. |