Bug 16892

Summary: "domain" directive in /etc/resolv.conf not consistent when using IPv6 and IPv4
Product: Base System Reporter: borjamar <borjamar>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description borjamar 2000-02-21 21:30:01 UTC
A machine with both IPv6 and IPv4 and an /etc/resolv.conf file with the
"domain" or "search" options searches addresses in wrong order (IMHO)
When resolving a domain-less name, the resolver does the queries in the 
following order: (for example, this is the "arnor.es" domain and I'm
trying to contact "nenuial")
1 - Query AAAA nenuial.arnor.es
2 - Query AAAA nenuial
3 - Query A nenuial.arnor.es
4 - Query A neuial

I think the order should be 1,3,2,4. The "domain" and "search" options in
/etc/resolv.conf specify that the domain suffix should be added to
domain-less names, and the current behavior violates this principle. Only
IPv6 queries work in this way.

In a network with demand-dialing to Internet, this causes the 
router to dial, as the suffix-less name has to be resolver outside
the local network.

Fix: 

Changing the order in which the queries are done.
How-To-Repeat: Enable both IPv4 and IPv6, and use a /etc/resolv.conf file with
a "domain" or "search" keyword.
Try to telnet, ping, ftp or whatever, one of the machines, using the
domain-less name.
Comment 1 borjamar 2000-02-22 12:25:02 UTC
	I have been looking at the code. The IPv6 resolution has
been added to /sys/lib/libc/net/gethostnamadr.c, modifying the
gethostbyname() function. With IPv6 enabled, it queries first for
a IPv6 address and, if this fails, for an IPv4 address.

	The queries for IPv6 and IPv4 should be done in the DNS
resolver routines, at a lower level, preserving the "search" and
"domain" semantics.

	A candidate would be res_search()? 
-- 
***********************************************************************
Borja Marcos                    * Internet: borjam@we.lc.ehu.es
Alangoeta, 11 1 izq             *           borjamar@sarenet.es
48990 - Algorta (Vizcaya)       *           borjam@uninet.edu
SPAIN                           *           borjam@well.com
***********************************************************************
--- FreeBSD, turning PCs into workstations
Comment 2 Hajimu UMEMOTO freebsd_committer freebsd_triage 2000-07-18 08:42:37 UTC
State Changed
From-To: open->closed
Comment 3 Hajimu UMEMOTO freebsd_committer freebsd_triage 2000-07-18 08:53:25 UTC
>>>>> On Tue, 18 Jul 2000 00:44:42 -0700 (PDT)
>>>>> ume@FreeBSD.org said:

ume> Synopsis: "domain" directive in /etc/resolv.conf not consistent when using IPv6 and IPv4

ume> State-Changed-From-To: open->closed
ume> State-Changed-By: ume
ume> State-Changed-When: Tue Jul 18 00:42:37 PDT 2000
ume> State-Changed-Why: 

Oops, I missed to add State-Changed-Why.
Recent changes to getaddrinfo.c fixed the DNS search order.

--
Hajimu UMEMOTO @ Business Solution System Development Div., Hitachi Ltd.
E-Mail: ume@bisd.hitachi.co.jp ume@mahoroba.org  ume@FreeBSD.org
URL: http://www.imasy.org/~ume/