Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!news.tu-graz.ac.at!fstgds01!chmr From: chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko) Subject: Re: 386BSD gethostname() problems Message-ID: <1992Oct8.190021.3275@news.tu-graz.ac.at> Sender: news@news.tu-graz.ac.at (USENET News System) Nntp-Posting-Host: fstgds01 Organization: Technical University of Graz, Austria References: <1992Oct8.044051.19526@fcom.cc.utah.edu> Date: Thu, 8 Oct 92 19:00:21 GMT Lines: 54 In article <1992Oct8.044051.19526@fcom.cc.utah.edu> terry@icarus.weber.edu writes: > Well, it bit me, so now it's obnoxious enough to do something about >it. 8-(. > > It seems that the functions "gethostbyname()" and "gethostbyaddr()" >in the file "/usr/src/lib/libc/net/gethostnamadr.c" attempt to query the >resolver *first*. They fall back to the local "/etc/hosts" file only if >they get the error "ECONNREFUSED". The problem is that this is the wrong >way to do things. [ Lotsa reasons deleted for brevity ] >Basically, this means that the "gethostbyname()" and "gethostbyaddr()" >should look in "/etc/hosts", and *then* go to the resolver if the lookup >there fails; the current order causes names in the local hosts file to >not be resolved, *even* if they are not resolved by the resolver. > >If anyone can make a case for *not* resolving from "/etc/hosts" with the >resolver active, or doing the "/etc/hosts" lookup *after* the resolver >lookup, please speak up. Otherwise, I'll make a patch for it if no one >speaks up within about a week. So here I stand (sit) and I speak up. I think querying the resolver only if the info is not found in /etc/hosts is better than the current situation. But if we do something, why not the *real thing* ? I very much like the way ULTRIX does it and I would like to see it implemented on 386bsd. If you don't know ULTRIX: it uses a file called /etc/svc.conf (services configuration file) which contains info on where to look for various services (hosts, networks, passwd). You could e.g. write: hosts=bind,local,yp which means for hosts, you want the computer to look on the nameserver, if it is not found there (for any reason), look in the local /etc/hosts, and finally in the yellow pages. I know that there is no yellow pages (aka NIS) for 386bsd, but this scheme is expandable for different sevices (passwd anyone ?) and lookup techniques. What I don't like on ULTRIX is that it fails if there is no /etc/svc.conf, it should provide a default behaviour (local lookup ?) The Ultrix svc.conf file also contains other info, for example whether it should use a shadow password file etc. I think this scheme is efficient, easy to configure and expandable. Well done DEC. Christoph PS.: Any volunteers ? -- ..signature: Destination address required