SSH login takes very long time...sometimes
Yar Tikhiy
yar at comp.chem.msu.su
Mon Feb 27 07:20:36 PST 2006
On Sat, Feb 25, 2006 at 02:08:21AM +0900, Hajimu UMEMOTO wrote:
> >>>>> On Fri, 24 Feb 2006 15:51:53 +0200
> >>>>> Rostislav Krasny <rosti.bsd at gmail.com> said:
>
> rosti> Excellent! What about RES_DFLRETRY decreasing from 4 to 2? Does it need
> rosti> more testing or discussion?
>
> It seems reasonable to me, and there are no objection here. So, I've
> just committed both into HEAD.
I finally spared some time to test your recent changes and found
that the resolver still would retry using the first, and only the
first, domain on the `search' list when the nameserver was down,
which effectively led to another kind of request doubling.
A similar effect was observed when a `domain' line was specified
in resolv.conf in place of `search'.
Is there a real reason to retry with a different domain when the
nameserver doesn't respond at all?
--
Yar
P.S. Here's the details of what I'm talking about:
Commands:
vpc7# hostname
vpc7
vpc7# cat /etc/resolv.conf
search aaa.ru bbb.ru
nameserver 195.208.208.25
vpc7# ./gethost foo
foo: Host name lookup failure
vpc7# ./gethost foo.zzz.ru
foo.zzz.ru: Host name lookup failure
tcpdump:
=== for ./gethost foo ===
18:01:51.756764 IP 10.1.1.27.51030 > 195.208.208.25.53: 5443+ A? foo.aaa.ru. (33)
18:01:56.971187 IP 10.1.1.27.57913 > 195.208.208.25.53: 5443+ A? foo.aaa.ru. (33)
18:02:07.071088 IP 10.1.1.27.55508 > 195.208.208.25.53: 5444+ A? foo. (21)
18:02:12.210384 IP 10.1.1.27.62824 > 195.208.208.25.53: 5444+ A? foo. (21)
=== for ./gethost foo.zzz.ru ===
18:02:33.509361 IP 10.1.1.27.65031 > 195.208.208.25.53: 19867+ A? foo.zzz.ru. (32)
18:02:38.567045 IP 10.1.1.27.55358 > 195.208.208.25.53: 19867+ A? foo.zzz.ru. (32)
18:02:48.824136 IP 10.1.1.27.61855 > 195.208.208.25.53: 19868+ A? foo.zzz.ru.aaa.ru. (44)
18:02:53.922071 IP 10.1.1.27.49351 > 195.208.208.25.53: 19868+ A? foo.zzz.ru.aaa.ru. (44)
Here's ./gethost src. It essentially calls a single gethostbyname()
if given a host name or gethostbyaddr() if given an IP address.
=== gethost.c ===
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
struct in_addr ia;
struct hostent *hp;
char *name;
char **st;
if (argc < 2)
return (2);
name = argv[1];
if (inet_aton(name, &ia))
hp = gethostbyaddr((char *)&ia, sizeof(ia), AF_INET);
else
hp = gethostbyname(name);
if (hp == NULL) {
herror(name);
return (1);
}
printf("%s\n", hp->h_name);
for (st = hp->h_addr_list; *st; st++)
printf("%s\n", inet_ntoa(*(struct in_addr *)*st));
if (st == hp->h_addr_list)
printf("no address records\n");
return (0);
}
More information about the freebsd-stable
mailing list