mike@unmvax.cs.unm.edu (Michael I. Bushnell) (06/11/89)
Hostname completions are a good idea, but there is a problem. With the resolv library (which BSD uses by DEFAULT, thank god), there is no gethostent function. Even if it were implemented (perhaps doing a depth-first search on the entire DNS), it would be far too slow when hooked up to the internet with named. Just too many hosts to page through. Has anyone else thought of this? If not, I'll pound out an approprite set of #ifdef's...it doesn't seem to be too complex. Sigh. (But I get to post the first bug to the newsgroup!) Michael I. Bushnell \ This above all; to thine own self be true GIG! \ And it must follow, as the night the day, mike@turing.cs..unm.edu /\ Thou canst not be false to any man. Snail mail: 87196-4292 / \ Farewell: my blessing season this in thee!
peiffer@umn-cs.CS.UMN.EDU (Tim J. Peiffer) (06/11/89)
In article <126@unmvax.unm.edu> mike@unmvax.cs.unm.edu writes: >Hostname completions are a good idea, but there is a problem. With >the resolv library (which BSD uses by DEFAULT, thank god), there is no >gethostent function. Even if it were implemented (perhaps doing a >depth-first search on the entire DNS), it would be far too slow when >hooked up to the internet with named. Just too many hosts to page >through. Uh, I hate to burst your bubble, but that is not exactly what happens. If the system implements gethostbyname(3N) properly, it first looks in the host tables to see if it exists there. Consider the name 'host' and a domain name of 'sub.sub_domain.domain'. Then the resolvers request an address - the resolver makes use of what is called a sliding window match. The resolver then, if name is not fully qualified (e.g. ends with a '.'), pulls off a domain name from /etc/resolv.conf. Then the name is presented to the DNS - fully qualified as host.sub.sub_domain.domain. (remember the terminating '.'). If the data is not found, a NXDOMAIN signal is returned. Then the domain name is pruned from the left -> host.sub_domain.domain. The name is resubmitted to the server and repruned until 'host.' fails. If the domain is not the same as the zone that the server is responsible for, the query is forwarded to an upline server until it either receives an authoritative answer or it reaches a root server and receives a NXDOMAIN response. Typically there are only 3-6 servers upline until you contact a root server. In my application, for any query, 6 queries is all that are done. This takes place inside of 10 seconds - tops at the worst of network conditions. >Has anyone else thought of this? No need. By the way, gethostent returns a pointer to a structure hostent in netdb.h. The object has the following structure containing the broken-out fields of a line in the network host data base, /etc/hosts. struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* address type */ int h_length; /* length of address */ char *h_addr; /* address */ }; This structure is used in *every* transaction that the resolver goes through. Tim Peiffer peiffer@umn-cs.cs.umn.edu Computer Science Department University of Minnesota, MPLS MN P.S. I thought this spot was reserved for bashing out GNU bugs..
mike@unmvax.cs.unm.edu (Michael I. Bushnell) (06/14/89)
In article <13429@umn-cs.CS.UMN.EDU> peiffer@umn-cs.cs.umn.edu (Tim J. Peiffer) writes: >In article <126@unmvax.unm.edu> mike@unmvax.cs.unm.edu writes: >>Hostname completions are a good idea, but there is a problem. With >>the resolv library (which BSD uses by DEFAULT, thank god), there is no >>gethostent function. Even if it were implemented (perhaps doing a >>depth-first search on the entire DNS), it would be far too slow when >>hooked up to the internet with named. Just too many hosts to page >>through. > Uh, I hate to burst your bubble, but that is not exactly what > happens. If the system implements gethostbyname(3N) properly, > it first looks in the host tables to see if it exists there. > Consider the name 'host' and a domain name of 'sub.sub_domain.domain'. Uh, I hate to burst YOUR bubble, but I know whereof I speak. The goal of GNU is to be upwardly compatable with the 4.3 BSD kernel and libraries. 4.3 BSD, when using the resolv routines (the default) has *no* gethostent function. Further, it is important to realize that local tables (/etc/hosts) are more likely wrong than are the authoritative DNX databases. > Then the resolvers request an address - the resolver makes > use of what is called a sliding window match. The resolver then, > if name is not fully qualified (e.g. ends with a '.'), pulls > off a domain name from /etc/resolv.conf. Unless, of course, you don't HAVE /etc/resolv.conf. SOME of us use local nameservers. It gets the domain name from the NAMESERVER (named has a default which it appends using a sliding window match. [UNIX 101 discussion of sliding window matches deleted...] > If the domain is not the same as the zone that the server is > responsible for, the query is forwarded to an upline server until > it either receives an authoritative answer or it reaches a root > server and receives a NXDOMAIN response. Typically there are > only 3-6 servers upline until you contact a root server. In > my application, for any query, 6 queries is all that are done. > This takes place inside of 10 seconds - tops at the worst of > network conditions. Look, Mr Condecension, I didn't say that ONE request took a long time. I said that a COMPLETION would take a long time...since it would have to build a table from the entire DNS, as /etc/hosts is wrong and incomplete. The UNM CS dept typically has only the addresses for the local machine and a few nearby important servers in /etc/hosts. >>Has anyone else thought of this? > No need. By the way, gethostent returns a pointer to a > structure hostent in netdb.h. The object has the following > structure containing the broken-out fields of a line in the > network host data base, /etc/hosts. > > struct hostent { > char *h_name; /* official name of host */ > char **h_aliases; /* alias list */ > int h_addrtype; /* address type */ > int h_length; /* length of address */ > char *h_addr; /* address */ > }; > This structure is used in *every* transaction that the > resolver goes through. Sigh!!!! The resolver uses struct rrec's for all its transactions. For once and for all: gethost* <> resolver. The gethost* routines are implemented in terms of calls to the resolver. The resolver routines either use resolv.conf to find out where to start, or they contact the local nameserver. Most importantly, in 4.3 BSD, NO reference is made to /etc/hosts if a successful communication is made to named. Your comments are quite true with respect to SUNOS. But GNU is supposed to assume the 4.3 BSD libraries as a starting point. Since I don't see the GNU implementation of gethost* or of the resolver routines, or named, I think we ought to stick with the standard. Completion of hostnames is a nice idea, but it doesn't come out that useful in the DNS environment. After all, what happens when I type: % @deimos[TAB] ??? Does it expand to deimos.unm.edu, or perhaps deimos.cis.ksu.edu, or any of a host of other possibilities? (Pun intended....) 'Nuff said. Michael I. Bushnell \ This above all; to thine own self be true GIG! \ And it must follow, as the night the day, mike@turing.cs..unm.edu /\ Thou canst not be false to any man. Snail mail: 87196-4292 / \ Farewell: my blessing season this in thee!
bfox@AUREL.CALTECH.EDU (Brian Fox) (06/14/89)
From: mike@unmvax.cs.unm.edu (Michael I. Bushnell) Sender: bug-bash-request@prep.ai.mit.edu In article <13429@umn-cs.CS.UMN.EDU> peiffer@umn-cs.cs.umn.edu (Tim J. Peiffer) writes: >In article <126@unmvax.unm.edu> mike@unmvax.cs.unm.edu writes: >>Hostname completions are a good idea, but there is a problem. With [15 pounds of useless discussion deleted] Look, Mr Condecension, I didn't say that ONE request took a long time. I don't understand why this discussion is taking place publicly. It is not a discussion on a bug in bash, it isn't even a philisophical discussion about bash. It sounds like two guys arguing over facts, which is the silliest thing that I have ever heard. I would really appreciate it if this list was used only for bug reports, fixes, and the occasional philosphical discussion on things pertaining directly to Bash. There are other forums (perhaps net.nameserver.flame) that would be more appropriate to the current discussion. In 1.00, I have implemented hostname completion differently; completion takes place over the names present in a file (default /etc/hosts). No host-like system calls are used in the implementation. I left room for the dynamic adding of hostnames, so that hostnames that you type can be added to the list of known hosts. Rationale: For systems without a nameserver, this is exactly right. For systems with a nameserver, hostname completion is provided to the extent that the installer felt was neccessary. Brian Fox
mike@unmvax.cs.unm.edu (Michael I. Bushnell) (06/15/89)
In article <8906141530.AA11840@aurel.caltech.edu> bfox@ai.mit.edu writes: >I don't understand why this discussion is taking place publicly. It is >not a discussion on a bug in bash, it isn't even a philisophical >discussion about bash. It sounds like two guys arguing over facts, I apologize. My original posting was an attempt to point out a bug in bash which prevented its compilation on 4.3 BSD using the normal libraries. When I was treated like a little child who didn't know which way was up, I reacted rather profusely. Michael I. Bushnell \ This above all; to thine own self be true GIG! \ And it must follow, as the night the day, mike@turing.cs..unm.edu /\ Thou canst not be false to any man. Snail mail: 87196-4292 / \ Farewell: my blessing season this in thee!
zmacx07@doc.ic.ac.uk (Simon E Spero) (06/23/89)
I have been playing around with the hostname completion stuff, and I've added a cache to hostname_completion_function. The first time the user tries to expand a hostname, the cache is filled before the match made. Subsequent calls use the cache information, which is refreshed after a fixed period of time. It appears to work, but I don't know how suitable it would be for people on the internet. This technique can also be applied to usernames, as both of these values are fairly static. If anybody is interested, I will post the patches, but they are still a bit grotty at the moment Simon -- ------------------------------------------------------------------------------ MAC-FREE | My Opinons are precisely that | "We Don't take no sh*t from a ZONE | No Liability accepted | machine"- Moontrap ------------------------------------------------------------------------------