diff options
author | Roger Dingledine <arma@torproject.org> | 2004-12-06 06:06:13 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-12-06 06:06:13 +0000 |
commit | 0859d09352fecddee8c9c12cd3e1ef6f46ad3a38 (patch) | |
tree | 3ce8cecf532c246dfbe02dbf0db695bf55b880c2 /src | |
parent | 577665f60819bebff5b7ed8e5d54a2dc874a3888 (diff) | |
download | tor-0859d09352fecddee8c9c12cd3e1ef6f46ad3a38.tar.gz tor-0859d09352fecddee8c9c12cd3e1ef6f46ad3a38.zip |
don't use cache for resolving .foo.exit names, but do reply immediately
if we're asked to resolve an IP.foo.exit.
svn:r3085
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection_edge.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index de17fce2ee..3fd7d67841 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -384,13 +384,17 @@ static int connection_ap_handshake_process_socks(connection_t *conn) { if (socks->command == SOCKS_COMMAND_RESOLVE) { uint32_t answer; + struct in_addr in; /* Reply to resolves immediately if we can. */ if (strlen(socks->address) > RELAY_PAYLOAD_SIZE) { log_fn(LOG_WARN,"Address to be resolved is too large. Failing."); connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR,0,NULL); return -1; } - answer = htonl(client_dns_lookup_entry(socks->address)); + if (tor_inet_aton(socks->address, &in)) /* see if it's an IP already */ + answer = ntohl(in.s_addr); + if (!answer && !conn->chosen_exit_name) /* if it's not .exit, check cache */ + answer = htonl(client_dns_lookup_entry(socks->address)); if (answer) { connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4, (char*)&answer); |