connect(2) behavior with unreacheable hosts
Barney Wolff
barney at pit.databus.com
Fri Apr 11 15:20:59 PDT 2003
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.
--
Barney Wolff http://www.databus.com/bwresume.pdf
I'm available by contract or FT, in the NYC metro area or via the 'Net.
More information about the freebsd-net
mailing list