Bug 133699

Summary: Not working with dns supplied from dnsmasq's hosts-file
Product: [Fedora] Fedora Reporter: Kyrre Ness Sjøbæk <kyrsjo>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-30 10:11:44 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 Kyrre Ness Sjøbæk 2004-09-26 15:33:36 UTC
Description of problem:

I have always before been able to run dnsmasq on my smoothwall, and if
i then put a host in its /etc/hosts, all (Linux - it has never worked
for my fathers win2000/XP laptop, so he has to use ip adresses...)
computers wich use that as a dns-server will get it.

F.ex. i have a host called "kyrre". If i want cups to be able to print
to the printer shared on that machine, i have to have a dns lookup for
"kyrre" - either on the local /ets/hosts, or in DNS. So the smoothwalls
hosts file look like this:

127.0.0.1       localhost
192.168.0.1     smoothwall
192.168.0.200   kyrre

And it works great. On all my fc2 (and earlier) linux-computers, i am
able to f.ex type "ssh kyrre", and it looks up kyrre from dns, dnsmasq
on the smoothwall reads the hosts file on the smoothwall, and returns
"192.168.0.200".

But with fc3t2, which has a hosts and resolve file which are identical
to the fc2 laptops, this dont work. That means - "host kyrre" returns
the correct IP, but "ssh kyrre" or printing on kyrre dont work
(acctually, hitting "print test page" in the cups web-interfafe just
gives me a google seach for "kyrre").

Normal dns through dnsmasq works fine - ex. typing
"bugzilla.redhat.com" makes it return an adress, and the webpage popps up.

Version-Release number of selected component (if applicable):
glibc-2.3.3-53

How reproducible:
Every time

Steps to Reproduce:
1. Install fedora 3 test 2
2. Use a dnsmasq as DNS-server
3. Enter an ip/hostname combo in the dnsmasq-running-server /etc/hosts
4. Not working on fc 3 test 2.
  
Actual results:
No local dns/hostname resolving

Expected results:

Works just as in fc2 and earlier.

Additional info:

Comment 1 Ulrich Drepper 2004-09-28 00:33:23 UTC
I have no idea what dnsmasq is and I'm not going to test arbitrary
programs.  You'll have to provide the details.

If this *program* (not the runtime) is supposed to look at /etc/hosts,
how can it be glibc's fault?

There has been only one change in glibc DNS code which might be
relevant.  In certain situations, names without any dots are not found
when they have been found before because the glibc resolver made one
additional call.  This call was really a bug AFAICS.  Try adding

options ndots:0

to your resolv.conf file and check again.

If this is not it, do some more work.  Look with ethereal at the DNS
traffic of the old and new OS.

Comment 2 Kyrre Ness Sjøbæk 2004-09-28 17:32:24 UTC
dnsmasq does not run on the local fc3t2 pc - it runs on my local
smoothwall-running linux router. It there reads the smoothwalls hosts
file, and also functions as a DNS cache.

All my machines has this router/DNS/dhcp box set as dns - ie
resolv.conf looks like this:

; generated by /sbin/dhclient-script
search sjobak
nameserver 192.168.0.1

This is true for both fc2 and fc3.

The hosts file on the computers look like this on fc2 (of course - the
others do not have the "kyrre"):

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       kyrre   localhost.localdomain   localhost

and on fc3:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost

And the hosts file from the smoothwall:
127.0.0.1       localhost
192.168.0.1     smoothwall
192.168.0.200   kyrre


So if i f.ex. do this on the fc2 laptop:

[kyrre@kyrrelaptop kyrre]$ ping kyrre
PING kyrre (192.168.0.200) 56(84) bytes of data.
64 bytes from kyrre (192.168.0.200): icmp_seq=0 ttl=64 time=7.20 ms
64 bytes from kyrre (192.168.0.200): icmp_seq=1 ttl=64 time=2.05 ms

--- kyrre ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 2.053/4.630/7.207/2.577 ms, pipe 2
[kyrre@kyrrelaptop kyrre]$

It works. It gets "kyrre" from the DNS server, and pings it.

Same goes to "host":

[kyrre@kyrrelaptop kyrre]$ host kyrre
kyrre has address 192.168.0.200

And dig:

[kyrre@kyrrelaptop kyrre]$ dig kyrre

; <<>> DiG 9.2.3 <<>> kyrre
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59646
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;kyrre.                         IN      A

;; ANSWER SECTION:
kyrre.                  0       IN      A       192.168.0.200

;; Query time: 3 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Tue Sep 28 17:33:22 2004
;; MSG SIZE  rcvd: 39

But if we now try this from the fc3t2 computer:

[kyrre@localhost ~]$ ping kyrre
ping: unknown host kyrre

[kyrre@localhost ~]$ host kyrre
kyrre has address 192.168.0.200

[kyrre@localhost ~]$ dig kyrre

; <<>> DiG 9.2.4rc7 <<>> kyrre
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44405
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;kyrre.                         IN      A

;; ANSWER SECTION:
kyrre.                  0       IN      A       192.168.0.200

;; Query time: 43 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Tue Sep 28 19:22:19 2004
;; MSG SIZE  rcvd: 39

We now try adding "options ndots:0" to resolv.conf:

; generated by /sbin/dhclient-script
search sjobak
nameserver 192.168.0.1
options ndots:0

[root@localhost ~]# ping kyrre
PING kyrre (192.168.0.200) 56(84) bytes of data.
64 bytes from kyrre (192.168.0.200): icmp_seq=0 ttl=64 time=0.270 ms
64 bytes from kyrre (192.168.0.200): icmp_seq=1 ttl=64 time=0.248 ms

--- kyrre ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.248/0.259/0.270/0.011 ms, pipe 2

Yup, it works when this is added. But it is still quite an annoyance -
being able to keep a network-wide /etc/host is very comfortable indeed.

Can you give me a pointer to more exact spesifications in what have
changed in /etc/hosts?

Comment 3 Ulrich Drepper 2004-09-30 10:11:44 UTC
Look at the changes from revision 1.19 to 1.20 of resolv/res_query.c
in glibc.

CLosing the bug since there is no problem, just a configuration issue.