SSH login takes very long time...sometimes

Hajimu UMEMOTO ume at freebsd.org
Sat Feb 25 08:59:03 PST 2006


Hi,

>>>>> On Sat, 25 Feb 2006 17:14:47 +0200
>>>>> Rostislav Krasny <rosti.bsd at gmail.com> said:

> > -			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.

rosti> The original code looked like that:

rosti> 			hints.ai_flags = 0;
rosti> 			hints.ai_family = AF_UNSPEC;
rosti> 			hints.ai_flags = AI_PASSIVE;

rosti> It looked like someone wanted to say to future developers: "if you don't
rosti> whant hints.ai_flags = AI_PASSIVE keep the hints.ai_flags = 0".
rosti> My comment might be not well formulated or even unnecessary, sorry.

I think it was just a bug.  So, we can just nuke this comment.

BTW, AI_CANONNAME is set to hints.ai_flags and AI_PASSIVE is not set,
just before the getaddrinfo(3) call above like following:

	hints.ai_flags = AI_CANONNAME;
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

Since ai_canonname is not used later, we don't need to set
AI_CANONNAME, here.  And, in this usage of getaddrinfo(3), we should
set AI_PASSIVE.  So, it should be same as lookup for ftphosts like
following:

	hints.ai_flags = AI_PASSIVE;
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the freebsd-stable mailing list