SSH login takes very long time...sometimes

Rostislav Krasny rosti.bsd at gmail.com
Sat Feb 25 15:46:35 PST 2006


On Sun, 26 Feb 2006 01:41:28 +0900
Hajimu UMEMOTO <ume at freebsd.org> wrote:

> Hi,
> 
> >>>>> On Sat, 25 Feb 2006 16:46:48 +0200
> >>>>> Rostislav Krasny <rosti.bsd at gmail.com> 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.


More information about the freebsd-stable mailing list