From owner-freebsd-net@FreeBSD.ORG Sat Apr 12 04:19:30 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1661337B404 for ; Sat, 12 Apr 2003 04:19:30 -0700 (PDT) Received: from imo-d04.mx.aol.com (imo-d04.mx.aol.com [205.188.157.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B23343F75 for ; Sat, 12 Apr 2003 04:19:29 -0700 (PDT) (envelope-from BelletJr@aol.com) Received: from BelletJr@aol.com by imo-d04.mx.aol.com (mail_out_v34.21.) id e.bb.3035e2d0 (18555); Sat, 12 Apr 2003 07:19:18 -0400 (EDT) From: BelletJr@aol.com Message-ID: Date: Sat, 12 Apr 2003 07:19:18 EDT To: barney@pit.databus.com MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: AOL 5.0 for Windows sub 116 cc: net@freebsd.org Subject: Re: connect(2) behavior with unreacheable hosts X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2003 11:19:30 -0000 >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).