connect(2) behavior with unreacheable hosts
BelletJr at aol.com
BelletJr at aol.com
Sat Apr 12 04:19:30 PDT 2003
>Dans un e-mail daté du 12/04/03 00:21:06 Paris, Madrid (Heure d'été),
barney at pit.databus.com a écrit :
>
>On Fri, Apr 11, 2003 at 01:14:15PM -0400, 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.
>
>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
>};
>
>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
get a signal discarded by default, but I haven't verified that).
More information about the freebsd-net
mailing list