From owner-freebsd-questions@FreeBSD.ORG Fri Feb 18 20:27:45 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A15EB16A4CE for ; Fri, 18 Feb 2005 20:27:45 +0000 (GMT) Received: from hobbiton.shire.net (hobbiton.shire.net [166.70.252.250]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6BD2243D55 for ; Fri, 18 Feb 2005 20:27:45 +0000 (GMT) (envelope-from chad@shire.net) Received: from [67.161.222.227] (helo=[192.168.99.68]) by hobbiton.shire.net with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.43) id 1D2Ej0-000Faj-UC; Fri, 18 Feb 2005 13:27:43 -0700 Mime-Version: 1.0 (Apple Message framework v619.2) Message-Id: <3e5d98bb57fe803a1292dba98f084a67@shire.net> From: Chad Leigh -- Shire.Net LLC Date: Fri, 18 Feb 2005 13:27:41 -0700 To: List Free Bsd X-Mailer: Apple Mail (2.619.2) X-SA-Exim-Connect-IP: 67.161.222.227 X-SA-Exim-Mail-From: chad@shire.net Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on hobbiton.shire.net X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=disabled version=3.0.0 X-Spam-Level: X-SA-Exim-Version: 4.1+cvs (built Mon, 23 Aug 2004 08:44:05 -0700) X-SA-Exim-Scanned: Yes (on hobbiton.shire.net) cc: William McKee Subject: Loopback addresses and socket() inside of jail X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2005 20:27:45 -0000 While tracking down test errors while installing Apache 2.0.53 and mod_perl2.0.0-RC4 into a jail process on a FreeBSD 5.3 server, we have encountered some errors with how the ip is being resolved for the loopback device. Using test code from the Apache project[1], we were able to determine that a client socket created with an unspecified sin_addr (which defaults to 0.0.0.0) is not able to resolve to the loopback device. If you patch the original nonblock.c with the lines listed below, the script will work and it will be apparent that the listener socket is able to resolve the 0.0.0.0 address to the real ip whereas the client is not. How does address 0.0.0.0 work inside of a jail? The code nonblock.c starts up a listener on that address, which works, and then tries to connect to it and it fails. Thanks, William McKee and Chad Leigh [1] http://www.apache.org/~jorton/nonblock.c 65a66 > printf("listening to %s:%d\n", inet_ntoa(sa.sin_addr), > listen_port); 76a78 > sa.sin_addr.s_addr = inet_addr ("127.0.0.1");