summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDesoxy <desoxy@fastmail.fm>2013-04-03 18:50:27 +0200
committerDesoxy <desoxy@fastmail.fm>2013-04-03 18:50:27 +0200
commit2c40138210fe934f687470fc4bd20513982bf424 (patch)
treeaf8dfb14ed37adf8ebea2b2378a6ba68fad24825 /src
parent33b7083f26e30304f6c9296e3cb7205f6bda0c95 (diff)
downloadtor-2c40138210fe934f687470fc4bd20513982bf424.tar.gz
tor-2c40138210fe934f687470fc4bd20513982bf424.zip
Controller: Always send ADDRMAP event after RESOLVE command (#8596 part 1/2)
Since 7536c40 only DNS results for real SOCKS requests are added to the cache, but not DNS results for DNSPort queries or control connection RESOLVE queries. Only cache additions would trigger ADDRMAP events on successful resolve. Change it so that DNS results received after a RESOLVE command also generate ADDRMAP events.
Diffstat (limited to 'src')
-rw-r--r--src/or/connection_edge.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 5075c474a3..0519708810 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2040,11 +2040,8 @@ tell_controller_about_resolved_result(entry_connection_t *conn,
int ttl,
time_t expires)
{
-
- if (ttl >= 0 && (answer_type == RESOLVED_TYPE_IPV4 ||
- answer_type == RESOLVED_TYPE_HOSTNAME)) {
- return; /* we already told the controller. */
- } else if (answer_type == RESOLVED_TYPE_IPV4 && answer_len >= 4) {
+ expires = time(NULL) + ttl;
+ if (answer_type == RESOLVED_TYPE_IPV4 && answer_len >= 4) {
char *cp = tor_dup_ip(ntohl(get_uint32(answer)));
control_event_address_mapped(conn->socks_request->address,
cp, expires, NULL);
@@ -2116,8 +2113,9 @@ connection_ap_handshake_socks_resolved(entry_connection_t *conn,
conn->socks_request->has_finished = 1;
return;
} else {
- /* This must be a request from the controller. We already sent
- * a mapaddress if there's a ttl. */
+ /* This must be a request from the controller. Since answers to those
+ * requests are not cached, they do not generate an ADDRMAP event on
+ * their own. */
tell_controller_about_resolved_result(conn, answer_type, answer_len,
(char*)answer, ttl, expires);
conn->socks_request->has_finished = 1;