Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2006 18:19:54 +0300
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        Hajimu UMEMOTO <ume@freebsd.org>
Cc:        freebsd-stable@freebsd.org, freebsd-stable-local@be-well.ilk.org, dwmalone@maths.tcd.ie, Rostislav Krasny <rosti.bsd@gmail.com>, des@des.no, mak@ll.mit.edu, MH@kernel32.de
Subject:   Re: SSH login takes very long time...sometimes
Message-ID:  <20060227151954.GV6435@comp.chem.msu.su>
In-Reply-To: <ygewtfkelbu.wl%ume@mahoroba.org>
References:  <20060218012029.e146e2ff.rosti.bsd@gmail.com> <20060219104912.GB20500@comp.chem.msu.su> <20060219225701.0e3e244b.rosti.bsd@gmail.com> <20060221165959.GB77513@comp.chem.msu.su> <20060222024430.ad4b5c60.rosti.bsd@gmail.com> <yge1wxvz5ha.wl%ume@mahoroba.org> <20060223235727.33cddb13.rosti.bsd@gmail.com> <ygefym98o7i.wl%ume@mahoroba.org> <20060224155153.f7da1a52.rosti.bsd@gmail.com> <ygewtfkelbu.wl%ume@mahoroba.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060227151954.GV6435>