From shimoda@junkyard.rcac.tdi.co.jp  Tue Oct 30 02:03:05 2001
Return-Path: <shimoda@junkyard.rcac.tdi.co.jp>
Received: from mx.junkyard.rcac.tdi.co.jp (mx.junkyard.rcac.tdi.co.jp [202.249.17.133])
	by hub.freebsd.org (Postfix) with ESMTP id EC6CD37B407
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Oct 2001 02:03:03 -0800 (PST)
Received: from bach.junkyard.rcac.tdi.co.jp (bach.junkyard.rcac.tdi.co.jp [3ffe:501:40b:80::138])
	by mx.junkyard.rcac.tdi.co.jp (8.11.6/8.11.6) with ESMTP id f9UA2to92131;
	Tue, 30 Oct 2001 19:02:55 +0900 (JST)
	(envelope-from shimoda@mx.junkyard.rcac.tdi.co.jp)
Received: (from shimoda@localhost)
	by bach.junkyard.rcac.tdi.co.jp (8.11.6/8.11.6) id f9UA2sC18635;
	Tue, 30 Oct 2001 19:02:54 +0900 (JST)
	(envelope-from shimoda)
Message-Id: <200110301002.f9UA2sC18635@bach.junkyard.rcac.tdi.co.jp>
Date: Tue, 30 Oct 2001 19:02:54 +0900 (JST)
From: Yuichi SHIMODA <shimoda@rcac.tdi.co.jp>
Reply-To: Yuichi SHIMODA <shimoda@rcac.tdi.co.jp>
To: FreeBSD-gnats-submit@freebsd.org
Subject: ip6fw error under DNS dislabled environment
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31632
>Category:       bin
>Synopsis:       ip6fw error under DNS dislabled environment
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    cjc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 30 02:10:01 PST 2001
>Closed-Date:    Wed Aug 28 14:16:19 PDT 2002
>Last-Modified:  Wed Aug 28 14:16:19 PDT 2002
>Originator:     Yuichi SHIMODA
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
T.D.I. CO., LTD.
>Environment:
System: FreeBSD bach.junkyard.rcac.tdi.co.jp 4.4-STABLE FreeBSD 4.4-STABLE #0: Wed Oct 24 22:19:51 JST 2001 shimoda@octa.junkyard.rcac.tdi.co.jp:/work/obj/home2/f4s/src/sys/GENERIC i386

>Description:
when my /etc/host.conf contains no "bind" entries,
ip6fw command with ipv6 address argument shows error message.

  ip6fw: error: hostname ``ff02::'' unknown
  usage: ip6fw [options]
    :
    :

>How-To-Repeat:
edit your /etc/host.conf:
  hosts
  # bind    <-- commented out
  # nis
use ip6fw command:
  ip6fw add allow ipv6-icmp from ff02::/16 to ::
  
>Fix:
--- /usr/src/sbin/ip6fw/ip6fw.c.ORIG	Tue Aug  7 10:27:56 2001
+++ /usr/src/sbin/ip6fw/ip6fw.c	Tue Oct 30 17:38:00 2001
@@ -516,9 +516,12 @@
 	char *host;
 	u_char *addr;
 {
-	struct hostent *he = gethostbyname2(host, family);
+	struct hostent *he;
 
-	if (!he)
+	if (inet_pton(family, host, &addr) == 1)
+		return 0;
+
+	if (!(he = gethostbyname2(host, family)))
 		return(-1);
 
 	memcpy(addr, he->h_addr_list[0], he->h_length);


>Release-Note:
>Audit-Trail:

From: "Crist J. Clark" <cristjc@earthlink.net>
To: Yuichi SHIMODA <shimoda@rcac.tdi.co.jp>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/31632: ip6fw error under DNS dislabled environment
Date: Thu, 15 Nov 2001 02:43:06 -0800

 On Tue, Oct 30, 2001 at 07:02:54PM +0900, Yuichi SHIMODA wrote:
 [snip]
 
 > >Description:
 > when my /etc/host.conf contains no "bind" entries,
 > ip6fw command with ipv6 address argument shows error message.
 > 
 >   ip6fw: error: hostname ``ff02::'' unknown
 >   usage: ip6fw [options]
 >     :
 >     :
 
 This bug was fixed in ipfw(8) long ago. There must be a way to keep
 these two in better sync (like, should they really be separate code
 bases?).
 
 This patch is more in sync with the current ipfw.c way to do this,
 
 Index: ip6fw.c
 ===================================================================
 RCS file: /export/ncvs/src/sbin/ip6fw/ip6fw.c,v
 retrieving revision 1.8
 diff -u -r1.8 ip6fw.c
 --- ip6fw.c	28 Oct 2001 20:19:14 -0000	1.8
 +++ ip6fw.c	15 Nov 2001 10:41:00 -0000
 @@ -515,15 +515,15 @@
  static int
  lookup_host (host, addr, family)
  	char *host;
 -	u_char *addr;
 +	struct in6_addr *addr;
  {
 -	struct hostent *he = gethostbyname2(host, family);
 -
 -	if (!he)
 -		return(-1);
 -
 -	memcpy(addr, he->h_addr_list[0], he->h_length);
 +	struct hostent *he;
  
 +	if (inet_pton(family, host, addr) != 1) {
 +		if ((he = gethostbyname2(host, family)) == NULL)
 +			return(-1);
 +		*addr = *(struct in6_addr *)he->h_addr_list[0];
 +	}	
  	return(0);
  }
  
 
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
State-Changed-From-To: open->analyzed 
State-Changed-By: cjc 
State-Changed-When: Sat Jul 13 15:05:48 PDT 2002 
State-Changed-Why:  
This is a bug. 


Responsible-Changed-From-To: freebsd-bugs->cjc 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Sat Jul 13 15:05:48 PDT 2002 
Responsible-Changed-Why:  
'Bout time someone fixed this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31632 
State-Changed-From-To: analyzed->patched 
State-Changed-By: cjc 
State-Changed-When: Sat Aug 24 22:44:28 PDT 2002 
State-Changed-Why:  
Fixed in -CURRENT. Will MFC in three days. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31632 
State-Changed-From-To: patched->closed 
State-Changed-By: cjc 
State-Changed-When: Wed Aug 28 14:15:51 PDT 2002 
State-Changed-Why:  
MFC'ed. 

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