Thread View: gnu.bash.bug
2 messages
2 total messages
Started by Michael I. Bushnell
Sat, 10 Jun 1989 17:05
gethostent call in readline.c
Author: Michael I. Bushnell
Date: Sat, 10 Jun 1989 17:05
Date: Sat, 10 Jun 1989 17:05
22 lines
1308 bytes
1308 bytes
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!
Re: gethostent call in readline.c
Author: Tim J. Peiffer
Date: Sun, 11 Jun 1989 03:55
Date: Sun, 11 Jun 1989 03:55
53 lines
3066 bytes
3066 bytes
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..
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads