[comp.protocols.tcp-ip.domains] Appending domain names to FQDNs

bryan@terminator.cc.umich.edu (Bryan Beecher) (04/12/90)

In article <ANG.90Apr11115530@mockingbird.lcs.mit.edu> ang@theory.lcs.mit.edu (William S. Ang) writes:
>
>I have the same problem with resolver appending domain names to fullly
>qualified hostname.  Anybody has fix for this problem?  Will this be
>fixed in 4.1?

Yes.  One of the changes I've made to the resolver library we use
at U-M is to use the count of the number of dots in the name (which
is already computed in res_search().  If there are two or more dots,
we FIRST use the name as it is; and if this fails, then we domain
extend.

This can lead to unexpected results:  if I'm in domain d.e.f and
I telnet to a.b.c, I will try to connect to a.b.c first, not
a.b.c.d.e.f, and so if I really wanted to go to the latter and
the former exists, the wrong thing happens.  In practice here
this case seems to be the exception rather than the rule, and
this small change has drastically cut down in the number of
queries our nameservers handle every day (by maybe about 33%).

The change is a small one in res_search() in res_query.c:

	for (cp = name, n = 0; *cp; cp++)
		if (*cp == '.')
			n++;
	if (n == 0 && (cp = hostalias(name)))
		return (res_query(cp, class, type, answer, anslen));
|	else if (n > 1) {
|		ret = res_query(name, class, type, answer, anslen);
|		if (ret > 0)
|			return (ret);
|	}
--
Bryan Beecher, U-M Information Technology Division  (+1 313 747 4050)
Domain:	bryan@terminator.cc.umich.edu  Path: mailrus!terminator!bryan