Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Feb 2005 13:27:41 -0700
From:      Chad Leigh -- Shire.Net LLC <chad@shire.net>
To:        List Free Bsd <freebsd-questions@freebsd.org>
Cc:        William McKee <william@knowmad.com>
Subject:   Loopback addresses and socket() inside of jail
Message-ID:  <3e5d98bb57fe803a1292dba98f084a67@shire.net>

next in thread | raw e-mail | index | archive | help
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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3e5d98bb57fe803a1292dba98f084a67>