From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 15 16:58:06 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A57B16A4CE for ; Fri, 15 Oct 2004 16:58:06 +0000 (GMT) Received: from web14822.mail.yahoo.com (web14822.mail.yahoo.com [216.136.225.172]) by mx1.FreeBSD.org (Postfix) with SMTP id 0C37543D46 for ; Fri, 15 Oct 2004 16:58:06 +0000 (GMT) (envelope-from rosti_bsd@yahoo.com) Message-ID: <20041015165805.62571.qmail@web14822.mail.yahoo.com> Received: from [212.143.154.227] by web14822.mail.yahoo.com via HTTP; Fri, 15 Oct 2004 09:58:05 PDT Date: Fri, 15 Oct 2004 09:58:05 -0700 (PDT) From: Rostislav Krasny To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Fwd: default resolver(5) configuration and behavior of functions like gethostbyname(3) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2004 16:58:06 -0000 Hello everybody. About two weeks ago I've sent following email to the freebsd-net mailing list but I didn't get any reply of it yet. Could someone of you answer to my questions those I've asked in my original email? Thank you. --- Rostislav Krasny wrote: > From Rostislav Krasny Thu Sep 30 08:31:24 2004 > Thu, 30 Sep 2004 08:31:24 PDT > Date: Thu, 30 Sep 2004 08:31:24 -0700 (PDT) > From: Rostislav Krasny > Subject: default resolver(5) configuration and behavior of functions like > gethostbyname(3) > To: freebsd-net@freebsd.org > MIME-Version: 1.0 > Content-Type: text/plain; charset=us-ascii > Content-Length: 1462 > > Hello all. Please consider following two questions: > > 1. According to the resolver(5) manual page the default number of times > the > resolver will send a query to each of its name servers is defined as > RES_DFLRETRY in resolv.h standard header file. Actually there was no > RES_DFLRETRY in the resolv.h before following commits to HEAD made by Yar > Tikhiy: > > http://docs.freebsd.org/cgi/mid.cgi?200409091739.i89HdlwM019548 > http://docs.freebsd.org/cgi/mid.cgi?200409091742.i89HgIan019681 > http://docs.freebsd.org/cgi/mid.cgi?200409091719.i89HJRGu019026 > > This default number of retries (the RES_DFLRETRY macro in the HEAD and a > hardcoded constant value in 5.x) is 4. But in most of other UNIX or > UNIX-like systems (Solaris, AIX, Linux, NetBSD) this default value is 2. > Only in OpenBSD it is 4 and also it is a hardcoded constant there. > > Please explain why developers of FreeBSD had chose 4 instead of 2? Maybe > they should change it to 2, as this default value is defined on most of > other systems, including NetBSD? > > > 2. Please consider following experimets I did on FreeBSD 5.3-BETA2-BETA6: > > I changed the /etc/resolv.conf so it had only one following line: > > nameserver 21.21.21.21 > > 21.21.21.21 is just some black-hole host without any working DNS on it. > Then I ran 'tcpdump -nvi ed1' on one pseudo terminal and 'ping yahoo.com' > on other pseudo terminal. This way I counted the "A? yahoo.com." DNS > queries before ping(8) returned an error. With this configuration there > were 8 "A? yahoo.com." DNS queries. Then I added following line to the > /etc/resolv.conf > > options attempts:1 > > With this configuration there were 2 "A? yahoo.com." DNS queries. With > "attempts:2" there were 4 "A? yahoo.com." DNS queries, with "attempts:3" > there were 6 "A? yahoo.com." DNS queries, with "attempts:5" there were 10 > "A? yahoo.com." DNS queries and so on. > > I repeated this experiment with following program been used instead of > the > ping(8): > > #include > #include > #include > #include > #include > #include > > int main(void) > { > const char *name="yahoo.com"; > struct hostent *ps_hostent; > char **st; > > ps_hostent=gethostbyname(name); > if (ps_hostent!=NULL) { > printf("%s\n", ps_hostent->h_name); > for (st=ps_hostent->h_addr_list; *st!=NULL; st++) { > printf("%s\n", > inet_ntoa(*(struct in_addr *)*st)); > } > if (st==ps_hostent->h_addr_list) > fputs("It have no address.\n", stderr); > } else { > herror(name); > } > return 0; > } > > The results where exactly the same. > > Why the number of DNS queries is always doubled? With default resolver(5) > configuration there are 8 DNS queries to one non-working DNS server and > it takes 2:30 minutes before an error returned. IMHO this is too much > time and too much queries for default resolver(5) configuration. Who and > why is doubling the number of DNS queries? Is it gethostbyname(3) > function or the resolver itself? __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail