aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-11-19 19:20:01 +1100
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-11-19 19:20:01 +1100
commitf19d6b81c8fd38e2f86f0405ea3f788aa10c647b (patch)
tree3369e8b4fc8060f513b3353e8770bbbfdaa6898a /src/test
parent53ec840bdfa3dfa421b3cecd7a90a3cd5e39d15c (diff)
downloadtor-f19d6b81c8fd38e2f86f0405ea3f788aa10c647b.tar.gz
tor-f19d6b81c8fd38e2f86f0405ea3f788aa10c647b.zip
Fixup #17638: ignore EINVAL from FreeBSD jails without ::1
In my testing, an IPv6-only FreeBSD jail without ::1 returned EINVAL from tor_ersatz_socketpair. Let's not fail the unit test because of this - it would only ever use tor_socketpair() anyway.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index eecc50a287..05c57c32a7 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4425,6 +4425,11 @@ test_util_socketpair(void *arg)
* 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)) {
+ /* 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]));