From csg@ns2.wintek.com  Mon Sep  8 11:54:52 1997
Received: from ns2.wintek.com ([199.233.104.69])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id LAA24368
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 8 Sep 1997 11:54:51 -0700 (PDT)
Received: (from csg@localhost)
	by ns2.wintek.com (8.8.5/8.8.5) id NAA28684;
	Mon, 8 Sep 1997 13:54:33 -0500 (EST)
Message-Id: <199709081854.NAA28684@ns2.wintek.com>
Date: Mon, 8 Sep 1997 13:54:33 -0500 (EST)
From: csg@wintek.com
Reply-To: csg@wintek.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Possible CIDR Reverse DNS Problem
X-Send-Pr-Version: 3.2

>Number:         4497
>Category:       bin
>Synopsis:       Reverse DNS fails for some CIDR *.IN-ADDR.ARPA domains
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep  8 12:00:01 PDT 1997
>Closed-Date:    Sun Jun 20 20:20:02 CDT 1999
>Last-Modified:  Sun Jun 20 20:22:43 CDT 1999
>Originator:     C. Stephen Gunn
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
Wintek Corporation
>Environment:

	Any FreeBSD 2.2+ machine, including 2.2-R, 2.2.1-R and 2.2.2-R,
but not in 2.1.6-R. 

>Description:

   Binaries not staticly linked with libresolv.a fail to do correct
DNS lookups on certain (not sure which or why) IN-ADDR.ARPA domains.
Two CIDR blocks assigned to Wintek that do not work are:

   206.230.0.0 - 206.230.7.0

   208.13.56.0 - 208.13.63.0

>How-To-Repeat:

   Login's to FreeBSD-2.2 machines from the IP's on these subnets do
show in utmp entries as the IP address not the hostname. Traceroutes for
these subnets fail (sometimes) as well.

   Be advised the "dig", "nslookup" and similar tools give correct
responses since they were linked with the resolver that comes with the
bind distribution, not the one in libc.

>Fix:

>Release-Note:
>Audit-Trail:

From: Alex Bulan <avb@korax.net>
To: freebsd-gnats-submit@freebsd.org, csg@wintek.com
Cc:  Subject: Re: bin/4497: Reverse DNS fails for some CIDR *.IN-ADDR.ARPA domains
Date: Sat, 24 Jan 1998 22:19:14 -0500 (EST)

 This doesn't appear to be a resolution problem, but rather a workaround
 for the 16-character hostname field size limit in utmp, wtmp and lastlog. 
 /usr/bin/login records the user's IP address, rather than the hostname, if
 the hostname is longer than 16 characters. 
 
 It was probably added as a feature around 2.2.2, as I don't seem to
 remember this happening before, but personally, I prefer to have the first
 16 characters of the hostname in there rather than the IP.  I was able to
 change this behaviour by commenting out the relevant `if' clause in
 /usr/bin/login:
 
 *** login.c.orig	Sun Oct 19 06:39:41 1997
 --- login.c	Sat Jan 24 14:48:22 1998
 ***************
 *** 210,216 ****
   			if (domain && (p = strchr(optarg, '.')) &&
   			    strcasecmp(p, domain) == 0)
   				*p = 0;
 ! 			if (strlen(optarg) > UT_HOSTSIZE) {
   				struct hostent *hp = gethostbyname(optarg);
   
   				if (hp != NULL) {
 --- 210,216 ----
   			if (domain && (p = strchr(optarg, '.')) &&
   			    strcasecmp(p, domain) == 0)
   				*p = 0;
 ! /*			if (strlen(optarg) > UT_HOSTSIZE) {
   				struct hostent *hp = gethostbyname(optarg);
   
   				if (hp != NULL) {
 ***************
 *** 221,227 ****
   				} else
   					optarg = "invalid hostname";
   			}
 ! 			hostname = optarg;
   			break;
   		case 'p':
   			pflag = 1;
 --- 221,227 ----
   				} else
   					optarg = "invalid hostname";
   			}
 ! */			hostname = optarg;
   			break;
   		case 'p':
   			pflag = 1;
 
 The better solution would be to make this an optional feature via a
 command-line flag.
 
 I also had to edit /usr/local/libexec/ftpd (wu-ftpd), and
 /usr/local/sbin/sshd, as they do the same thing.  I'm not sure about the
 stock ftpd server as I don't use it.  rlogind/rshd should be fine as
 I believe they use /bin/login.
 
 This kind of begs the question, though, why is the hostname field size
 only 16 characters?  Are there plans to increase it in a future release?
 
 --
 Alex Bulan <avb@korax.net>                                    +1 416 979 2112
 Systems Administrator, Korax Online Inc.                http://www.korax.net/
 
 

From: Guy Helmer <ghelmer@cs.iastate.edu>
To: freebsd-gnats-submit@freebsd.org, csg@wintek.com
Cc:  
Subject: Re: bin/4497: Reverse DNS fails for some CIDR *.IN-ADDR.ARPA domains
Date: Thu, 03 Jun 1999 21:15:02 -0500

 Is this still a problem in 3.x-stable or 4.0-current?
 
 Guy Helmer
 ghelmer@freebsd.org
 
State-Changed-From-To: open->closed 
State-Changed-By: ghelmer 
State-Changed-When: Sun Jun 20 20:20:02 CDT 1999 
State-Changed-Why:  
PR author could not be contacted to verify problem in current releases. 
>Unformatted:
