From nobody  Sun Oct 27 00:16:00 1996
Received: (from nobody@localhost)
          by freefall.freebsd.org (8.7.5/8.7.3) id AAA12009;
          Sun, 27 Oct 1996 00:16:00 -0700 (PDT)
Message-Id: <199610270716.AAA12009@freefall.freebsd.org>
Date: Sun, 27 Oct 1996 00:16:00 -0700 (PDT)
From: bmah@CS.Berkeley.EDU
To: freebsd-gnats-submit@freebsd.org
Subject: route(8) add -host does a meaningless nameserver lookup
X-Send-Pr-Version: www-1.0

>Number:         1900
>Category:       bin
>Synopsis:       route(8) add -host does a meaningless nameserver lookup
>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:   Sun Oct 27 00:20:00 PDT 1996
>Closed-Date:    Sun Oct 27 09:42:22 PST 1996
>Last-Modified:  Sun Oct 27 09:43:15 PST 1996
>Originator:     Bruce A. Mah
>Release:        2.1.0-RELEASE
>Organization:
University of California at Berkeley, Computer Science Division
>Environment:
FreeBSD wintermute.hip.berkeley.edu 2.1.0-RELEASE FreeBSD 2.1.0-RELEASE #0: Fri Feb  9 17:16:24 PST 1996     bmah@wintermute.hip.berkeley.edu:/usr/src/sys/compile/BMAH1  i386

>Description:
route(8) performs getnetbyname(3) lookups on hostname arguments even
if -host flag is given.  This can result in non-intuitive behavior
with respect to /etc/host.conf.  Setting host.conf to check hosts
then bind won't necessarily prevent a nameserver lookup during the
command "route add -host hostname gateway", even if both hostname
and gateway are defined in /etc/hosts.  Note that it's extremely
unlikely that getnetbyname(3) will return a meaningful answer
in this situation, anyways.

This condition arose when trying to set up a caching-only nameserver
on a host that was (at boot time) not connected to the Internet.
The route(8) commands in /etc/netstart were hanging waiting for the
local named(8) to respond, even though all of the hostname arguments
to route(8) were listed in /etc/hosts and route(8) was given a -host
flag.

I think that 2.1.5-RELEASE and 2.2-CURRENT also have this problem.

>How-To-Repeat:
See above.

>Fix:
*** route.c.orig        Wed Sep 14 10:35:37 1994
--- route.c     Fri Oct 25 23:27:30 1996
***************
*** 860,866 ****
                }
        }
        if ((val = inet_network(s)) != -1 ||
!           ((np = getnetbyname(s)) != NULL && (val = np->n_net) != 0)) {
  netdone:
                if (which == RTA_DST)
                        inet_makenetandmask(val, &su->sin);
--- 860,866 ----
                }
        }
        if ((val = inet_network(s)) != -1 ||
!           (forcehost == 0 && (np = getnetbyname(s)) != NULL && (val = np->n_net) != 0)) {
  netdone:
                if (which == RTA_DST)
                        inet_makenetandmask(val, &su->sin);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: fenner 
State-Changed-When: Sun Oct 27 09:42:22 PST 1996 
State-Changed-Why:  
Fixed in rev 1.16 of src/sbin/route/route.c 
>Unformatted:
