commit 35bfd782eae29646dcf69e6fff84030721ff7a7d Merge: 5f4cd24 2c151d8 Author: Nick Mathewson nickm@torproject.org Date: Thu Nov 19 11:19:31 2015 -0500
Merge remote-tracking branch 'teor/bug17632-no-ipv4-no-localhost-squashed'
src/test/test_util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --cc src/test/test_util.c index 05c57c3,187cb23..4cf2f9b --- a/src/test/test_util.c +++ b/src/test/test_util.c @@@ -4421,16 -4424,12 +4424,17 @@@ test_util_socketpair(void *arg int socketpair_result = 0;
socketpair_result = tor_socketpair_fn(family, SOCK_STREAM, 0, fds); + /* If there is no 127.0.0.1 or ::1, tor_ersatz_socketpair will and must fail. + * Otherwise, we risk exposing a socketpair on a routable IP address. (Some + * BSD jails use a routable address for localhost. Fortunately, they have + * the real AF_UNIX socketpair.) */ - if (-socketpair_result == SOCK_ERRNO(EINVAL)) { + if (ersatz && ERRNO_IS_EPROTO(-socketpair_result)) { - /* Assume we're on an IPv6-only system, and give up now. - * (tor_ersatz_socketpair uses IPv4.) */ + /* In my testing, an IPv6-only FreeBSD jail without ::1 returned EINVAL. + * Assume we're on a machine without 127.0.0.1 or ::1 and give up now. */ goto done; } tt_int_op(0, OP_EQ, socketpair_result); ++ tt_assert(SOCKET_OK(fds[0])); tt_assert(SOCKET_OK(fds[1])); tt_int_op(get_n_open_sockets(), OP_EQ, n + 2);
tor-commits@lists.torproject.org