From logix@foobar.franken.de  Thu Aug 15 10:34:31 2002
Return-Path: <logix@foobar.franken.de>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 18A1F37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Aug 2002 10:34:31 -0700 (PDT)
Received: from mailout11.sul.t-online.com (mailout11.sul.t-online.com [194.25.134.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DF5AD43E72
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Aug 2002 10:34:29 -0700 (PDT)
	(envelope-from logix@foobar.franken.de)
Received: from fwd03.sul.t-online.de 
	by mailout11.sul.t-online.com with smtp 
	id 17fOVw-0003MT-0B; Thu, 15 Aug 2002 19:34:28 +0200
Received: from foobar.franken.de (520066542279-0001@[217.229.166.39]) by fmrl03.sul.t-online.com
	with esmtp id 17fOXD-06j9BwC; Thu, 15 Aug 2002 19:35:47 +0200
Received: from foobar.franken.de (localhost [127.0.0.1])
	by foobar.franken.de (8.12.5/8.12.5) with ESMTP id g7FHYMNr066448
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Aug 2002 19:34:23 +0200 (CEST)
	(envelope-from logix@foobar.franken.de)
Received: (from logix@localhost)
	by foobar.franken.de (8.12.5/8.12.5/Submit) id g7FHYLRn066447;
	Thu, 15 Aug 2002 19:34:21 +0200 (CEST)
Message-Id: <200208151734.g7FHYLRn066447@foobar.franken.de>
Date: Thu, 15 Aug 2002 19:34:21 +0200 (CEST)
From: Harold Gutch <logix@foobar.franken.de>
Reply-To: Harold Gutch <logix@foobar.franken.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: libc lacks RFC 3152 compliance (patch included)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41689
>Category:       bin
>Synopsis:       libc lacks RFC 3152 compliance (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 15 10:40:01 PDT 2002
>Closed-Date:    Sun Nov 03 12:24:22 PST 2002
>Last-Modified:  Sun Nov 03 12:24:22 PST 2002
>Originator:     Harold Gutch
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD foobar.franken.de 4.6-STABLE FreeBSD 4.6-STABLE #3: Wed Aug 7 01:01:01 CEST 2002 logix@foobar.franken.de:/usr/obj/usr/src/sys/FOOBAR i386


	
>Description:
The FreeBSD libc does reverse resolving in the IPv6 address space using the
IP6.INT domain (RFC 1886).  RFC 3152 supersedes this and recommends using
the IP6.ARPA domain.
>How-To-Repeat:
	
>Fix:
The following patch makes libc reverse resolve IPv6 addresses in the
IP6.ARPA domain.  If this fails, it falls back to the old behaviour
and tries to resolve the IPv6 address in the IP6.INT domain.
Apply, recompile etc.

--- src/lib/libc/net/gethostbydns.c.orig	Wed Jul  3 10:52:42 2002
+++ src/lib/libc/net/gethostbydns.c	Thu Aug 15 19:02:08 2002
@@ -666,12 +666,17 @@
 				       uaddr[n] & 0xf,
 				       (uaddr[n] >> 4) & 0xf));
 		}
-		strcpy(qp, "ip6.int");
+		strcpy(qp, "ip6.arpa");
 		break;
 	default:
 		abort();
 	}
 	n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
+	if (n < 0 && af == AF_INET6) {
+		strcpy(qp, "ip6.int");
+		n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf,
+		    sizeof buf.buf);
+	}
 	if (n < 0) {
 		dprintf("res_query failed (%d)\n", n);
 		return NS_UNAVAIL;
--- src/lib/libc/net/name6.c.orig	Wed Jul  3 10:52:43 2002
+++ src/lib/libc/net/name6.c	Thu Aug 15 19:00:34 2002
@@ -1549,7 +1549,7 @@
 			*bp++ = hex[c >> 4];
 			*bp++ = '.';
 		}
-		strcpy(bp, "ip6.int");
+		strcpy(bp, "ip6.arpa");
 		break;
 #endif
 	default:
@@ -1567,6 +1567,12 @@
 	}
 
 	n = res_query(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf);
+#ifdef INET6
+	if (n < 0 && af == AF_INET6) {
+		strcpy(bp, "ip6.int");
+		n = res_query(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf);
+	}
+#endif
 	if (n < 0) {
 		*errp = h_errno;
 		return NS_UNAVAIL;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: arved 
State-Changed-When: Sun Nov 3 12:24:14 PST 2002 
State-Changed-Why:  
Orginators request 

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