Subject: Re: Recent changes to getnetbyname() causes route to fail
To: Duncan McEwan <duncan@mcs.vuw.ac.nz>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 08/04/1997 08:22:34
On Mon, 04 Aug 1997 22:24:33 +1200 
 Duncan McEwan <duncan@MCS.VUW.AC.NZ> wrote:

 > Yep.  It looks like my sources (and presumably Paul's) were from a period
 > sometime between when getnetby* was altered to do DNS lookups and when
 > Jason added support for looking at the resolv.conf "lookup" directive.
 > Until Jason's changes I think it always used the DNS first, regardless of
 > what resolv.conf told it.  The doc/CHANGES file from a newer current has the
 > following entry in it:
 > 
 >         libc: now that getnetby*() supports BIND lookups (as opposed
 >                 to only files), add support for dispatch for via
 >                 "lookup ..." in /etc/resolv.conf, a'la gethostby*().
 >                 [thorpej 970731]
 > 
 > [Sigh!] Time to "make build" again... :-)

Actually, it turns out that there is another slight problem.  Basically,
if the network is not fully up yet, and the file lookup fails, you will
block waiting for the BIND lookup, which will time out.  This could still
cause "hangs" (really, just delays) when performing the:

	route add $hostname localhost

HOWEVER...

Luke Mewburn committed a fix for this just yesterday (or the day before?
I was behind on my mail for a day)... Basically, the above route command
is _wrong_, and should not really be performed under any circumstances,
especially if your hostname doens't resolve to an IP address (which is
the case in many multi-homed or mobile environments).

Luke's fix was to actually use 4.4BSD's "automagic" adding of this route
when an interface is configured... You need to update your /etc/* startup
files in order to get this fix.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-6                                       Work: +1 415 604 0935
Moffett Field, CA 94035                             Pager: +1 415 428 6939