summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-01-14 13:59:07 -0500
committerNick Mathewson <nickm@torproject.org>2019-01-14 13:59:07 -0500
commit99947c3ce0a34f8a2dd8c201f8ef348666da403a (patch)
tree34025ae85b06ba48d0c7d37c53afe076b395f6b3
parentcef910642efb1f9a2db16146eb8a191327b51310 (diff)
parent671c34d9b496ecdde67527cc10b657ff6bd35c9e (diff)
downloadtor-99947c3ce0a34f8a2dd8c201f8ef348666da403a.tar.gz
tor-99947c3ce0a34f8a2dd8c201f8ef348666da403a.zip
Merge remote-tracking branch 'teor/bug29015'
-rw-r--r--src/lib/net/socket.c4
-rw-r--r--src/lib/net/socketpair.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/net/socket.c b/src/lib/net/socket.c
index 8940e00591..385c987e68 100644
--- a/src/lib/net/socket.c
+++ b/src/lib/net/socket.c
@@ -458,7 +458,9 @@ get_n_open_sockets(void)
* localhost is inaccessible (for example, if the networking
* stack is down). And even if it succeeds, the socket pair will not
* be able to read while localhost is down later (the socket pair may
- * even close, depending on OS-specific timeouts).
+ * even close, depending on OS-specific timeouts). The socket pair
+ * should work on IPv4-only, IPv6-only, and dual-stack systems, as long
+ * as they have the standard localhost addresses.
*
* Returns 0 on success and -errno on failure; do not rely on the value
* of errno or WSAGetLastError().
diff --git a/src/lib/net/socketpair.c b/src/lib/net/socketpair.c
index 6a21581d87..b4aeb6eba7 100644
--- a/src/lib/net/socketpair.c
+++ b/src/lib/net/socketpair.c
@@ -105,7 +105,12 @@ sockaddr_eq(struct sockaddr *sa1, struct sockaddr *sa2)
/**
* Helper used to implement socketpair on systems that lack it, by
* making a direct connection to localhost.
- */
+ *
+ * See tor_socketpair() for details.
+ *
+ * The direct connection defaults to IPv4, but falls back to IPv6 if
+ * IPv4 is not supported.
+ **/
int
tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
{