connect(2) behavior with unreacheable hosts

BelletJr at aol.com BelletJr at aol.com
Fri Apr 11 10:14:26 PDT 2003


>Dans un e-mail daté du 11/04/03 00:23:16 Paris, Madrid (Heure d'été), 
tlambert2 at mindspring.com a écrit :
>
>BelletJr at aol.com wrote:
>> Why does not connect(2) return any error when trying to connect to a host
>> unreachable because of an infinite loop in the routes? No time-out occurs 
and
>> the value 0 is returned by connect(2).
>> My test was done with TCP/IPv4.
>
>Because it can't detect an infinite routing loop.

Then why can't it detect an infinite routing loop? :) It does not implement 
the classic three-way handshake of a TCP connection establishment??

If this is the case, I think the man page is not precise enough. It states 
"If the socket is of type SOCK_STREAM, this call attempts to make a 
connection to another socket" and later on "The connect() function returns 
the value 0 if successful".

BTW we can imagine that the majority of programs aren't crafted to handle 
this case. Have a look for example to the simple "daytime.c" program from the 
developper handbook. It just doesn't do anything if time.nist.gov is 
unreachable because of an infinite routing loop.

Jerome


More information about the freebsd-net mailing list