From netch@segfault.kiev.ua  Tue Feb 22 22:34:29 2005
Return-Path: <netch@segfault.kiev.ua>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6AEC116A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 Feb 2005 22:34:29 +0000 (GMT)
Received: from segfault.kiev.ua (segfault.kiev.ua [193.193.193.4])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A6E9B43D46
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 Feb 2005 22:34:28 +0000 (GMT)
	(envelope-from netch@segfault.kiev.ua)
Received: (from root@localhost)
	by segfault.kiev.ua (8) id j1MMYPOt017960;
	Wed, 23 Feb 2005 00:34:25 +0200 (EET)
	(envelope-from netch)
Message-Id: <200502222234.j1MMYPOt017960@segfault.kiev.ua>
Date: Wed, 23 Feb 2005 00:34:25 +0200 (EET)
From: Valentin Nechayev <netch@netch.kiev.ua>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: BIND tools fail on hosts without IPv6 and NSes with AAAA
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         77937
>Category:       bin
>Synopsis:       BIND tools fail on hosts without IPv6 and NSes with AAAA
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 22 22:40:16 GMT 2005
>Closed-Date:    Wed Feb 23 13:34:33 GMT 2005
>Last-Modified:  Wed Feb 23 13:34:33 GMT 2005
>Originator:     Segmentation Fault
>Release:        FreeBSD 4.9-RELEASE-p12 i386
>Organization:
private
>Environment:
FreeBSD 4.9-RELEASE-p12
FreeBSD 4.11-RELEASE

>Description:

When quering something from NSes with AAAA (e.g. ns.ripe.net) on host without
IPv6 in kernel, dig, host, nslookup fail to fall back to IPv4.

>How-To-Repeat:

Screenshot of failure:

$ dig @ns.ripe.net -x 193 ns

; <<>> DiG 8.3 <<>> @ns.ripe.net -x ns 
; (2 servers found)
;; res options: init recurs defnam dnsrch
;; res_nsend: Protocol not supported


>Fix:

Patch follows.

--- contrib/bind/lib/resolv/res_send.c.0	Tue Jan 25 12:42:56 2005
+++ contrib/bind/lib/resolv/res_send.c	Wed Feb 23 00:19:22 2005
@@ -765,7 +765,7 @@
 		if (EXT(statp).nssocks[ns] < 0) {
 			*terrno = errno;
 			Perror(statp, stderr, "socket(dg)", errno);
-			return (-1);
+			return (*terrno == EPROTONOSUPPORT ? 0 : -1);
 		}
 #ifndef CANNOT_CONNECT_DGRAM
 		/*
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Wed Feb 23 13:32:28 GMT 2005 
State-Changed-Why:  

This kind of patch should really be sent to the BIND authors. 
The canonical solution to this problem traditionally has been 
to use the IPv4 address of the host, rather than the host name. 

I agree that your suggestion has merit, but I do not want to 
introduce such a fundamental difference in the way that BIND 
works on FreeBSD from other platforms.  


Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Wed Feb 23 13:32:28 GMT 2005 
Responsible-Changed-Why:  

I generally maintain BIND bits. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77937 
>Unformatted:
