From owner-freebsd-stable@FreeBSD.ORG Sat Feb 25 14:47:10 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 C351016A422 for ; Sat, 25 Feb 2006 14:47:10 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E84743D75 for ; Sat, 25 Feb 2006 14:47:00 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: by zproxy.gmail.com with SMTP id o1so598222nzf for ; Sat, 25 Feb 2006 06:46:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type:content-transfer-encoding; b=flHcDulPGR0ggiK5jhYOY3SZ7NTRNhl3p1b8G3DzxISYrgZ5UqFFtvO+EsYGpz8URglwE6TYzgyIPDhCAyfsN9RICNMgM7iLpWu20pB7XxCKd6wMv4nl2TCjOQ4c9TsxKBbPVWskuyb2ZuOxPie5+tVqTYqSoJZnWAda53FtMVs= Received: by 10.65.239.3 with SMTP id q3mr1651758qbr; Sat, 25 Feb 2006 06:46:59 -0800 (PST) Received: from saturn.lan ( [212.143.154.227]) by mx.gmail.com with ESMTP id e18sm1666673qba.2006.02.25.06.46.54; Sat, 25 Feb 2006 06:46:58 -0800 (PST) Date: Sat, 25 Feb 2006 16:46:48 +0200 From: Rostislav Krasny To: Hajimu UMEMOTO Message-Id: <20060225164648.a4eed65c.rosti.bsd@gmail.com> In-Reply-To: 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> X-Mailer: Sylpheed version 2.2.0 (GTK+ 2.8.12; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org, freebsd-stable-local@be-well.ilk.org, yar@comp.chem.msu.su, 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 14:47:11 -0000 On Sat, 25 Feb 2006 16:28:50 +0900 Hajimu UMEMOTO wrote: > 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: "family = his_addr.su_family;" is really a good idea. But what is the reason to check if IPv6 address of a remote client is IPv4 mapped and assign AF_INET to a 'family' when that's true? The inithosts() doesn't lookup for that address but for the server's hostname and optionally virtual server's hostnames from /etc/ftphosts. I think it's unnecessary and can even produce problems. IMHO "inithosts(family);" could be called right after the "family = his_addr.su_family;" line. > For ftp.c.diff, how about considering adding new option for timeout? That was what I thought about when wrote my previous email. What name could be good for that option? Is "-c seconds" (ftp Command reply timeout in seconds) a good one? > However, I'm still in doubt. I cannot think it is usual situation > that there are unreachable IP addresses in /etc/resolv.conf. It is unusual situation but it can happen. Otherwise this duscussion was not started.