From owner-freebsd-stable@FreeBSD.ORG Sat Feb 25 15:21:03 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 1E38816A422 for ; Sat, 25 Feb 2006 15:21:03 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8779F43D45 for ; Sat, 25 Feb 2006 15:21:02 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: by wproxy.gmail.com with SMTP id i24so498803wra for ; Sat, 25 Feb 2006 07:21:01 -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=Y0uqXp+8XDtr9qzimf/jUuVa/aAz8iHX29yaR+77xu9ErfoQe1KqNq62eGf75h8eI/DySGRDMOoHzvK7+5cWzT40XHx05WxRSoH7cZz18gk/qfLKR8QIhdU+0g/YhVriICYnG9YQ5eyKUzquldSRGdazNRMFxCY2N4lfnck6qFY= Received: by 10.65.53.11 with SMTP id f11mr85915qbk; Sat, 25 Feb 2006 07:14:55 -0800 (PST) Received: from saturn.lan ( [212.143.154.227]) by mx.gmail.com with ESMTP id e18sm1681970qba.2006.02.25.07.14.50; Sat, 25 Feb 2006 07:14:55 -0800 (PST) Date: Sat, 25 Feb 2006 17:14:47 +0200 From: Rostislav Krasny To: Yar Tikhiy Message-Id: <20060225171447.3e16a657.rosti.bsd@gmail.com> In-Reply-To: <20060225142207.GA80338@comp.chem.msu.su> References: <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> <20060225142207.GA80338@comp.chem.msu.su> 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, dwmalone@maths.tcd.ie, des@des.no, mak@ll.mit.edu, MH@kernel32.de, freebsd-stable-local@be-well.ilk.org 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 15:21:03 -0000 On Sat, 25 Feb 2006 17:22:07 +0300 Yar Tikhiy wrote: > > However I was unable to connect by ftp, even with only one unreachable > > name server in resolv.conf. I got following error: > > > > 421 Service not available, remote server timed out. Connection closed > > > > I've found the problem in both: ftpd(8) and ftp(1). In the ftpd(8) a > > getaddrinfo() is called in two places with hints.ai_socktype == 0 and > > hints.ai_family == PF_UNSPEC. In the ftp(1) a command reply timeout is > > only 60 seconds. Those things are what I've changed to fix the problem. > > Two diffs are attached to this email. The ftpd.c.diff extends -4 and -6 > > ftpd options. So if this patch is good, the ftpd(8) manual page and the > > default /etc/inetd.conf should also be changed appropriately. > > Could you explain please how your patch would affect ftpd(8) semantics > visible to the user? ftpd(8) has -4 and -6 options, which originally are used in daemon mode only. With my patch they are used in inetd mode too. But Hajimu showed me that in the inetd mode the 'family' variable could be assigned according to remote client's address family. Please read my recent reply to his email. > > Although I changed two getaddrinfo() calls in ftpd.c, only first of > > them is really called on default FreeBSD configuration, > > when /etc/ftphosts isn't existing yet. So there might be a need of > > additional increase of the command reply timeout in ftp.c. Or better if > > this timeout could be configurable by some new ftp(1) option, with 120 > > seconds by default. > > > --- libexec/ftpd/ftpd.c.orig Wed Feb 8 18:54:05 2006 > > +++ libexec/ftpd/ftpd.c Sat Feb 25 00:30:26 2006 > > @@ -239,7 +239,7 @@ > > } > > > > #ifdef VIRTUAL_HOSTING > > -static void inithosts(void); > > +static void inithosts(int); > > static void selecthost(union sockunion *); > > #endif > > static void ack(char *); > > @@ -424,7 +424,7 @@ > > } > > > > #ifdef VIRTUAL_HOSTING > > - inithosts(); > > + inithosts(family); > > #endif > > > > if (daemon_mode) { > > @@ -663,7 +663,7 @@ > > */ > > > > static void > > -inithosts(void) > > +inithosts(int family) > > { > > int insert; > > size_t len; > > @@ -689,7 +689,8 @@ > > > > memset(&hints, 0, sizeof(hints)); > > hints.ai_flags = AI_CANONNAME; > > - hints.ai_family = AF_UNSPEC; > > + hints.ai_family = family; > > + hints.ai_socktype = SOCK_STREAM; > > if (getaddrinfo(hrp->hostname, NULL, &hints, &res) == 0) > > hrp->hostinfo = res; > > hrp->statfile = _PATH_FTPDSTATFILE; > > @@ -759,9 +760,10 @@ > > /* NOTREACHED */ > > } > > > > - hints.ai_flags = 0; > > - hints.ai_family = AF_UNSPEC; > > + /* If no flag, assign hints.ai_flags to zero! */ > > Sorry, but I don't understand the purpose of this comment here. The original code looked like that: hints.ai_flags = 0; hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_PASSIVE; It looked like someone wanted to say to future developers: "if you don't whant hints.ai_flags = AI_PASSIVE keep the hints.ai_flags = 0". My comment might be not well formulated or even unnecessary, sorry.