From owner-freebsd-stable@FreeBSD.ORG Sat Feb 25 23:46:35 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 CA2AA16A420 for ; Sat, 25 Feb 2006 23:46:35 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id CFD3743D45 for ; Sat, 25 Feb 2006 23:46:34 +0000 (GMT) (envelope-from rosti.bsd@gmail.com) Received: by wproxy.gmail.com with SMTP id 37so88853wra for ; Sat, 25 Feb 2006 15:46:34 -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=ZzfeAXJgLWAl0MuHLC36mw1mSnkFMbrutU6XXMoXY/7Qumjj22idQzUGObNBIw/lyeUEcBMLb557Jqqbmirq6YVh241JVTfvMH69bVMHvmhCSrfkevv0TKfqAa+oiKr80B2+9+E/bISc8fABc2vdcSrErO+HfkJjgk1PYYU3V/E= Received: by 10.65.183.8 with SMTP id k8mr4192969qbp; Sat, 25 Feb 2006 15:46:33 -0800 (PST) Received: from saturn.lan ( [212.143.154.227]) by mx.gmail.com with ESMTP id e15sm982148qba.2006.02.25.15.46.30; Sat, 25 Feb 2006 15:46:33 -0800 (PST) Date: Sun, 26 Feb 2006 01:46:30 +0200 From: Rostislav Krasny To: Hajimu UMEMOTO Message-Id: <20060226014630.cc0b04ab.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> <20060225164648.a4eed65c.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 23:46:35 -0000 On Sun, 26 Feb 2006 01:41:28 +0900 Hajimu UMEMOTO wrote: > Hi, > > >>>>> On Sat, 25 Feb 2006 16:46:48 +0200 > >>>>> Rostislav Krasny said: > > rosti> "family = his_addr.su_family;" is really a good idea. But what is the > rosti> reason to check if IPv6 address of a remote client is IPv4 mapped and > rosti> assign AF_INET to a 'family' when that's true? The inithosts() doesn't > rosti> lookup for that address but for the server's hostname and optionally > rosti> virtual server's hostnames from /etc/ftphosts. I think it's unnecessary > rosti> and can even produce problems. IMHO "inithosts(family);" could be > rosti> called right after the "family = his_addr.su_family;" line. > > No, when a local address of a connection is an IPv4-mapped IPv6 > address, selecthost() does test it as a native IPv4 address. So, we > need to lookup hostnames as an IPv4 in inithosts(). Please refer > selecthost() for detail. As far as I understand the code of selecthost() it walks through linked lists of known virtual hosts and their addresses and compares the addresses to a local address of connected socket. This way it tries to find - configuration of what virtual host should be used. There is an additional comparison that seems like a workaround for misconfigured virtual host that can be resolved only to IPv4 address and should be used on IPv4-mapped IPv6 address. If virtual hosts are properly configured that hack is not needed, IMHO. Anyway selecthost() is called with local socket name and it checks a local address, while his_addr.su_sin6.sin6_addr is a remote address. Local and remote hosts have same address families but not same addresses.