From owner-freebsd-net@FreeBSD.ORG Fri Apr 11 15:20:59 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 015FC37B401 for ; Fri, 11 Apr 2003 15:20:59 -0700 (PDT) Received: from pit.databus.com (p70-227.acedsl.com [66.114.70.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BF4343FBF for ; Fri, 11 Apr 2003 15:20:58 -0700 (PDT) (envelope-from barney@pit.databus.com) Received: from pit.databus.com (localhost [127.0.0.1]) by pit.databus.com (8.12.9/8.12.9) with ESMTP id h3BMKudN049958; Fri, 11 Apr 2003 18:20:56 -0400 (EDT) (envelope-from barney@pit.databus.com) Received: (from barney@localhost) by pit.databus.com (8.12.9/8.12.9/Submit) id h3BMKusM049957; Fri, 11 Apr 2003 18:20:56 -0400 (EDT) Date: Fri, 11 Apr 2003 18:20:56 -0400 From: Barney Wolff To: BelletJr@aol.com Message-ID: <20030411222056.GA49927@pit.databus.com> References: <1dc.74b8b15.2bc851e7@aol.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1dc.74b8b15.2bc851e7@aol.com> User-Agent: Mutt/1.4.1i X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) 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: Fri, 11 Apr 2003 22:20:59 -0000 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.