From owner-freebsd-stable@FreeBSD.ORG Sat Feb 25 07:29:32 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 45F1816A420 for ; Sat, 25 Feb 2006 07:29:32 +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 95A7A43D46 for ; Sat, 25 Feb 2006 07:29:31 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from kasuga.mahoroba.org (IDENT:KfeozIfN1YTpBEmuJPdmTwrQHpDe8dtNgBx8hNNzn1hiJzymfIGNLGzr43NsSiAS@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 k1P7SsHd012790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 Feb 2006 16:28:55 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sat, 25 Feb 2006 16:28:50 +0900 Message-ID: From: Hajimu UMEMOTO To: Rostislav Krasny In-Reply-To: <20060225024246.d6284719.rosti.bsd@gmail.com> 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> <20060224174007.GF36227@comp.chem.msu.su> <20060225024246.d6284719.rosti.bsd@gmail.com> 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]); Sat, 25 Feb 2006 16:29:00 +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, Yar Tikhiy , dwmalone@maths.tcd.ie, 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: Sat, 25 Feb 2006 07:29:32 -0000 Hi, >>>>> On Sat, 25 Feb 2006 02:42:46 +0200 >>>>> Rostislav Krasny said: rosti> I've found the problem in both: ftpd(8) and ftp(1). In the ftpd(8) a rosti> getaddrinfo() is called in two places with hints.ai_socktype == 0 and rosti> hints.ai_family == PF_UNSPEC. In the ftp(1) a command reply timeout is rosti> only 60 seconds. Those things are what I've changed to fix the problem. rosti> Two diffs are attached to this email. The ftpd.c.diff extends -4 and -6 rosti> ftpd options. So if this patch is good, the ftpd(8) manual page and the rosti> default /etc/inetd.conf should also be changed appropriately. For your ftpd.c.diff, I like your idea to reduce redundant query. It is enough to query just appropriate address family. In inetd mode, we know the address family already. So, we don't need to rely on the -4/-6 option. The following diff is against ftpd.c with your patch applied: --- ftpd.c.rosti Sat Feb 25 15:41:52 2006 +++ ftpd.c Sat Feb 25 16:01:46 2006 @@ -423,10 +423,6 @@ main(int argc, char *argv[], char **envp } } -#ifdef VIRTUAL_HOSTING - inithosts(family); -#endif - if (daemon_mode) { int *ctl_sock, fd, maxfd = -1, nfds, i; fd_set defreadfds, readfds; @@ -456,6 +452,10 @@ main(int argc, char *argv[], char **envp sa.sa_handler = reapchild; (void)sigaction(SIGCHLD, &sa, NULL); +#ifdef VIRTUAL_HOSTING + inithosts(family); +#endif + /* * Open a socket, bind it to the FTP port, and start * listening. @@ -525,6 +525,14 @@ main(int argc, char *argv[], char **envp syslog(LOG_ERR, "getpeername (%s): %m",argv[0]); exit(1); } + +#ifdef VIRTUAL_HOSTING + family = his_addr.su_family; + if (his_addr.su_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&his_addr.su_sin6.sin6_addr)) + family = AF_INET; + inithosts(family); +#endif } gotchild: For ftp.c.diff, how about considering adding new option for timeout? However, I'm still in doubt. I cannot think it is usual situation that there are unreachable IP addresses in /etc/resolv.conf. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/