Date: Fri, 11 Apr 2003 18:20:56 -0400 From: Barney Wolff <barney@pit.databus.com> To: BelletJr@aol.com Cc: net@freebsd.org Subject: Re: connect(2) behavior with unreacheable hosts Message-ID: <20030411222056.GA49927@pit.databus.com> In-Reply-To: <1dc.74b8b15.2bc851e7@aol.com> References: <1dc.74b8b15.2bc851e7@aol.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 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.
--
Barney Wolff http://www.databus.com/bwresume.pdf
I'm available by contract or FT, in the NYC metro area or via the 'Net.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030411222056.GA49927>
