From owner-freebsd-stable@FreeBSD.ORG Tue Feb 28 15:30:33 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5CE2C16A420 for ; Tue, 28 Feb 2006 15:30:33 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from ameno.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26CDD43D45 for ; Tue, 28 Feb 2006 15:30:31 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from kasuga.mahoroba.org (IDENT:XezC2PuHWCi7QwRhCU8wcPqR+zhNX4WCWhhNr+5xj46MLgUk4Y3Yw7HGVD13vy6N@kasuga-iwi.mahoroba.org [IPv6:3ffe:501:185b:8010:212:f0ff:fe52:6ac]) (user=ume mech=CRAM-MD5 bits=0) by ameno.mahoroba.org (8.13.4/8.13.4) with ESMTP/inet6 id k1SFSErv093451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Mar 2006 00:28:15 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Wed, 01 Mar 2006 00:28:14 +0900 Message-ID: From: Hajimu UMEMOTO To: Yar Tikhiy In-Reply-To: <20060227151954.GV6435@comp.chem.msu.su> 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> <20060223235727.33cddb13.rosti.bsd@gmail.com> <20060224155153.f7da1a52.rosti.bsd@gmail.com> <20060227151954.GV6435@comp.chem.msu.su> User-Agent: xcite1.38> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.0.50 (i386-unknown-freebsd6.1) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 6.1-PRERELEASE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.1.3 (ameno.mahoroba.org [IPv6:3ffe:501:185b:8010::1]); Wed, 01 Mar 2006 00:28:26 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on ameno.mahoroba.org Cc: freebsd-stable@freebsd.org, freebsd-stable-local@be-well.ilk.org, dwmalone@maths.tcd.ie, Rostislav Krasny , des@des.no, mak@ll.mit.edu, MH@kernel32.de Subject: Re: SSH login takes very long time...sometimes X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2006 15:30:33 -0000 Hi, >>>>> On Mon, 27 Feb 2006 18:19:54 +0300 >>>>> Yar Tikhiy said: yar> I finally spared some time to test your recent changes and found yar> that the resolver still would retry using the first, and only the yar> first, domain on the `search' list when the nameserver was down, yar> which effectively led to another kind of request doubling. yar> A similar effect was observed when a `domain' line was specified yar> in resolv.conf in place of `search'. yar> Is there a real reason to retry with a different domain when the yar> nameserver doesn't respond at all? It seems yet another issue. The errors returned by res_querydomain() are not handled uniformity. Please try following patch: Index: lib/libc/net/getaddrinfo.c diff -u -p lib/libc/net/getaddrinfo.c.orig lib/libc/net/getaddrinfo.c --- lib/libc/net/getaddrinfo.c.orig Sun Feb 26 16:04:41 2006 +++ lib/libc/net/getaddrinfo.c Tue Feb 28 16:21:15 2006 @@ -2440,6 +2440,17 @@ res_searchN(name, target) ret = res_querydomainN(name, NULL, target); if (ret > 0 || trailing_dot) return (ret); + if (errno == ECONNREFUSED) { + h_errno = TRY_AGAIN; + return (-1); + } + switch (h_errno) { + case NO_DATA: + case HOST_NOT_FOUND: + break; + default: + return (-1); + } saved_herrno = h_errno; tried_as_is++; } @@ -2515,6 +2526,14 @@ res_searchN(name, target) } } + switch (h_errno) { + case NO_DATA: + case HOST_NOT_FOUND: + break; + default: + goto giveup; + } + /* * If the query has not already been tried as is then try it * unless RES_NOTLDQUERY is set and there were no dots. @@ -2534,6 +2553,7 @@ res_searchN(name, target) * else send back meaningless h_errno, that being the one from * the last DNSRCH we did. */ +giveup: if (saved_herrno != -1) h_errno = saved_herrno; else if (got_nodata) Index: lib/libc/net/res_query.c diff -u -p lib/libc/net/res_query.c.orig lib/libc/net/res_query.c --- lib/libc/net/res_query.c.orig Sun Feb 26 16:04:41 2006 +++ lib/libc/net/res_query.c Tue Feb 28 16:14:23 2006 @@ -229,6 +229,17 @@ res_search(name, class, type, answer, an ret = res_querydomain(name, NULL, class, type, answer, anslen); if (ret > 0 || trailing_dot) return (ret); + if (errno == ECONNREFUSED) { + h_errno = TRY_AGAIN; + return (-1); + } + switch (h_errno) { + case NO_DATA: + case HOST_NOT_FOUND: + break; + default: + return (-1); + } saved_herrno = h_errno; tried_as_is++; } @@ -318,6 +329,14 @@ res_search(name, class, type, answer, an } } + switch (h_errno) { + case NO_DATA: + case HOST_NOT_FOUND: + break; + default: + goto giveup; + } + /* * If the query has not already been tried as is then try it * unless RES_NOTLDQUERY is set and there were no dots. @@ -336,6 +355,7 @@ res_search(name, class, type, answer, an * else send back meaningless h_errno, that being the one from * the last DNSRCH we did. */ +giveup: if (saved_herrno != -1) h_errno = saved_herrno; else if (got_nodata) Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/