diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-10-31 22:04:25 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-11-14 23:16:24 -0500 |
commit | 6e27282dab8f4d4999830f0310ea3f8aa75c6b63 (patch) | |
tree | 3dfaa9449dece92c6c2d65e4a1d30ba7b3768a4d | |
parent | 5ee1de65b09e51ed2eea740cfd95ade3abe99e58 (diff) | |
download | tor-6e27282dab8f4d4999830f0310ea3f8aa75c6b63.tar.gz tor-6e27282dab8f4d4999830f0310ea3f8aa75c6b63.zip |
Better checking of exit policies for connections by hostname
-rw-r--r-- | src/or/connection_edge.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index e1c6938a93..c14e116706 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2625,11 +2625,15 @@ connection_ap_can_use_exit(const entry_connection_t *conn, const node_t *exit) } if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) { - struct in_addr in; tor_addr_t addr, *addrp = NULL; addr_policy_result_t r; - if (tor_inet_aton(conn->socks_request->address, &in)) { - tor_addr_from_in(&addr, &in); + if (0 == tor_addr_parse(&addr, conn->socks_request->address)) { + addrp = &addr; + } else if (!conn->ipv4_traffic_ok && conn->ipv6_traffic_ok) { + tor_addr_make_null(&addr, AF_INET6); + addrp = &addr; + } else if (conn->ipv4_traffic_ok && !conn->ipv6_traffic_ok) { + tor_addr_make_null(&addr, AF_INET); addrp = &addr; } r = compare_tor_addr_to_node_policy(addrp, conn->socks_request->port,exit); |