diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-03 14:13:08 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-16 23:03:25 -0400 |
commit | 08ef8c0958ebeb134e4f29d1738c85c0ac81e71d (patch) | |
tree | 6b3c91287e0122e9b1250a806bf141f5e0edd8fb /src | |
parent | 3e4680f3126c2a06358535b08bf267dca1bb90a7 (diff) | |
download | tor-08ef8c0958ebeb134e4f29d1738c85c0ac81e71d.tar.gz tor-08ef8c0958ebeb134e4f29d1738c85c0ac81e71d.zip |
tor_addr_from_sockaddr() is applicable in ipfw code, so use it.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection_edge.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index ddeac10381..2ece2e44e3 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1439,15 +1439,7 @@ connection_ap_get_original_destination(entry_connection_t *conn, if (get_options()->TransProxyType_parsed == TPT_IPFW) { /* ipfw(8) is used and in this case getsockname returned the original destination */ - if (proxy_sa->sa_family == AF_INET) { - struct sockaddr_in *dest_addr4 = (struct sockaddr_in *)proxy_sa; - tor_addr_from_ipv4n(&addr, dest_addr4->sin_addr.s_addr); - req->port = ntohs(dest_addr4->sin_port); - } else if (proxy_sa->sa_family == AF_INET6) { - struct sockaddr_in6 *dest_addr6 = (struct sockaddr_in6 *)proxy_sa; - tor_addr_from_in6(&addr, &dest_addr6->sin6_addr); - req->port = ntohs(dest_addr6->sin6_port); - } else { + if (tor_addr_from_sockaddr(&addr, proxy_sa, &req->port) < 0) { tor_fragile_assert(); return -1; } |