summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-02 16:11:02 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-02 16:11:02 -0400
commitdfdf32404cd93671646481f6f3c129591a6901d7 (patch)
treed2a9227818cd7fd7a1e85443cd808df8724c14cf /src/or
parentcd2be4283c8b4f8543649b067f198e7cf43652c1 (diff)
downloadtor-dfdf32404cd93671646481f6f3c129591a6901d7.tar.gz
tor-dfdf32404cd93671646481f6f3c129591a6901d7.zip
Partially revert "Use tor_addr_from_getsockname() in several places"
This reverts part of commit 6ed384b827dce21ea3a44b587, in order to fix bug 26568. Bugfix on 0.3.4.1-alpha.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 5185b45b14..7283a81043 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1260,12 +1260,15 @@ connection_listener_new(const struct sockaddr *listensockaddr,
gotPort = usePort;
} else {
tor_addr_t addr2;
- if (tor_addr_from_getsockname(&addr2, s)<0) {
+ struct sockaddr_storage ss;
+ socklen_t ss_len=sizeof(ss);
+ if (getsockname(s, (struct sockaddr*)&ss, &ss_len)<0) {
log_warn(LD_NET, "getsockname() couldn't learn address for %s: %s",
conn_type_to_string(type),
tor_socket_strerror(tor_socket_errno(s)));
gotPort = 0;
}
+ tor_addr_from_sockaddr(&addr2, (struct sockaddr*)&ss, &gotPort);
}
#ifdef HAVE_SYS_UN_H
/*