Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2003 07:19:18 EDT
From:      BelletJr@aol.com
To:        barney@pit.databus.com
Cc:        net@freebsd.org
Subject:   Re: connect(2) behavior with unreacheable hosts
Message-ID:  <bb.3035e2d0.2bc95036@aol.com>

next in thread | raw e-mail | index | archive | help
>Dans un e-mail dat=E9 du 12/04/03 00:21:06 Paris, Madrid (Heure d'=E9t=E9),=
=20
barney@pit.databus.com a =E9crit :
>
>On Fri, Apr 11, 2003 at 01:14:15PM -0400, BelletJr@aol.com wrote:
>> >> Why does not connect(2) return any error when trying to connect to a=20
host
>> >> unreachable because of an infinite loop in the routes? No time-out=20
occurs=20
>> and
>> >> the value 0 is returned by connect(2).
>> >> My test was done with TCP/IPv4.
>
>Well, after actually looking at this, I believe it's a bug, in both
>current and stable.  The following patch appears to fix it:
>
>--- ip_input.c.orig     Wed Apr  9 14:07:16 2003
>+++ ip_input.c  Fri Apr 11 17:54:11 2003
>@@ -1696,7 +1696,7 @@
>        0,              EMSGSIZE,       EHOSTDOWN,      EHOSTUNREACH,
>        EHOSTUNREACH,   EHOSTUNREACH,   ECONNREFUSED,   ECONNREFUSED,
>        EMSGSIZE,       EHOSTUNREACH,   0,              0,
>-       0,              0,              0,              0,
>+       0,              0,              EHOSTUNREACH,   0,
>        ENOPROTOOPT,    ECONNREFUSED
>};
> =20
>I'll file a PR.
>By the way, the reason programs appear to do nothing after hitting the
>problem is that they get SIGPIPE when trying to write on the socket.

And if they just read from it, they just don't see anything (or perhaps they=
=20
get a signal discarded by default, but I haven't verified that).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb.3035e2d0.2bc95036>